]> Savannah Git Hosting - gnulib.git/commitdiff
javacomp: Fix resource leak. stable-202501
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 13:56:51 +0000 (15:56 +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 bc27692f05045ad8731a3657f71cdf42dc999c39..557c4c7386147a9bdf48223f9092f436ead2a1aa 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 c024c15a661523a34bbb626aa9e5d8ba465378ed..33ec8eb63e4b5c109d83b2d33dbdc4764344b23e 100644 (file)
@@ -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')