I'm not sure why we check the mode only after invoking popen(3) but we need to close the file pointer.
Spotted by Coverity. Cc: Juan Quintela <quint...@redhat.com> Cc: qemu-sta...@nongnu.org Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> --- savevm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/savevm.c b/savevm.c index 31dcce9..75cc72e 100644 --- a/savevm.c +++ b/savevm.c @@ -329,6 +329,7 @@ QEMUFile *qemu_popen_cmd(const char *command, const char *mode) if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) { fprintf(stderr, "qemu_popen: Argument validity check failed\n"); + fclose(stdio_file); return NULL; } -- 1.8.1.4