From 630f2f65887cb01eb01252b9c38ad8dbefc8ee98 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 463cd83a9c..6026666ac0 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-30 Bruno Haible New module hashcode-string1. 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