libqtest: only call fclose() on open files
PATCH 1/1 libqtest: only call fclose() on open files
libqtest.c can segfault when calling fclose() if the pidfile wasn't opened successfully. This patch fixes the issue.
Signed-off-by Jesse Larrew <[email protected]>
--- tests/libqtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/libqtest.c +1 -1
@@ -99,8 +99,8 @@ static pid_t qtest_qemu_pid(QTestState *s)if (fgets (buffer,sizeof (buffer), f)) { pid =atoi (buffer); } +fclose (f); } -fclose (f);return pid; }
Signature · 1 line
1.7.11.7
Quoted 4 lines · Jesse Larrew
libqtest.ccan segfault when callingfclose()if the pidfile wasn't opened successfully. This patch fixes the issue.Signed-off-by Jesse Larrew <[email protected]>
Reviewed-by Anthony Liguori <[email protected]>
Regards,
Anthony Liguori
Quoted 20 lines
--- tests/libqtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/libqtest.c +1
-1@@ -99,8 +99,8 @@ static pid_t qtest_qemu_pid(QTestState *s)if (fgets (buffer,sizeof (buffer), f)) { pid =atoi (buffer); } +fclose (f); } -fclose (f);return pid; }Signature · 1 line
1.7.11.7
Anthony Liguori
AppliedApplied. Thanks.
Regards,
Anthony Liguori