From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ui3dB-0006IE-E5 for qemu-devel@nongnu.org; Thu, 30 May 2013 10:15:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ui3d5-0003wg-6u for qemu-devel@nongnu.org; Thu, 30 May 2013 10:15:05 -0400 From: Stefan Hajnoczi Date: Thu, 30 May 2013 16:14:46 +0200 Message-Id: <1369923286-22260-4-git-send-email-stefanha@redhat.com> In-Reply-To: <1369923286-22260-1-git-send-email-stefanha@redhat.com> References: <1369923286-22260-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH 3/3] savevm: avoid leaking popen(3) file pointer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Markus Armbruster , Stefan Hajnoczi , Juan Quintela 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 Cc: qemu-stable@nongnu.org Signed-off-by: Stefan Hajnoczi --- 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