qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] libqtest: only call fclose() on open files
@ 2013-04-29 15:52 Jesse Larrew
  2013-04-30 14:51 ` Anthony Liguori
  2013-05-02 15:55 ` Anthony Liguori
  0 siblings, 2 replies; 3+ messages in thread
From: Jesse Larrew @ 2013-04-29 15:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, aliguori, Jesse Larrew

libqtest.c can segfault when calling fclose() if the pidfile wasn't
opened successfully. This patch fixes the issue.

Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
---
 tests/libqtest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/libqtest.c b/tests/libqtest.c
index 884f959..879ffe9 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -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;
 }
 
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-02 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-29 15:52 [Qemu-devel] [PATCH] libqtest: only call fclose() on open files Jesse Larrew
2013-04-30 14:51 ` Anthony Liguori
2013-05-02 15:55 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).