]> Savannah Git Hosting - gnulib.git/commitdiff
javacomp: Fix resource leak. stable-202407
authorBruno Haible <bruno@clisp.org>
Thu, 1 May 2025 15:28:06 +0000 (17:28 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 3 May 2025 14:08:29 +0000 (16:08 +0200)
* lib/javacomp.c (execute_and_read_line): Upon failure, close the stream
and wait for the child process to terminate.

ChangeLog
lib/javacomp.c

index 2749ca7eed7b2c0f4ab5e1a628fabf210262fd5e..ca293062553ec4405c262c4711902d3bfb745556 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-05-01  Bruno Haible  <bruno@clisp.org>
+
+       javacomp: Fix resource leak.
+       * lib/javacomp.c (execute_and_read_line): Upon failure, close the stream
+       and wait for the child process to terminate.
+
 2025-04-28  Bruno Haible  <bruno@clisp.org>
 
        sigsegv: Fix compilation error on Mac OS X 10.4/powerpc.
index 107f373740ec7ed414a6edce2ddb04e3321cedac..03484be9f78d9495cf6551b01e5010908a3e66cb 100644 (file)
@@ -1,5 +1,5 @@
 /* Compile a Java program.
-   Copyright (C) 2001-2003, 2006-2024 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2006-2025 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software: you can redistribute it and/or modify
@@ -359,6 +359,8 @@ execute_and_read_line (const char *progname,
   if (linelen == (size_t)(-1))
     {
       error (0, 0, _("%s subprocess I/O error"), progname);
+      fclose (fp);
+      wait_subprocess (child, progname, true, false, true, false, NULL);
       return NULL;
     }
   if (linelen > 0 && line[linelen - 1] == '\n')