From bf19e06c483c8efc150966947baf492b1b398bc7 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 1 May 2025 17:28:06 +0200 Subject: [PATCH] javacomp: Fix resource leak. * lib/javacomp.c (execute_and_read_line): Upon failure, close the stream and wait for the child process to terminate. --- ChangeLog | 6 ++++++ lib/javacomp.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index bc27692f05..557c4c7386 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2025-05-01 Bruno Haible + + 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 sigsegv: Fix compilation error on Mac OS X 10.4/powerpc. diff --git a/lib/javacomp.c b/lib/javacomp.c index c024c15a66..33ec8eb63e 100644 --- a/lib/javacomp.c +++ b/lib/javacomp.c @@ -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') -- 2.39.5