diff options
author | Jesse Larrew <jlarrew@linux.vnet.ibm.com> | 2013-04-29 10:52:52 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-04-30 16:04:14 -0500 |
commit | beb54a87ba74dfac00906b4c876945c6602cd293 (patch) | |
tree | 7423a6f46308a3b0a5313bd294a1a5eaff8c1d31 /tests/libqtest.c | |
parent | 08eb8c85e3967b97865d46acadf26dc908fbb094 (diff) |
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 <jlarrew@linux.vnet.ibm.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1367250772-17928-1-git-send-email-jlarrew@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'tests/libqtest.c')
-rw-r--r-- | tests/libqtest.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/libqtest.c b/tests/libqtest.c index 884f959992..879ffe91dc 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; } |