Received: from eggs.gnu.org ([2001:4830:134:3::10]:42328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu7LJ-0008GY-Eo for qemu-devel@nongnu.org; Tue, 02 Jul 2013 16:38:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uu7LI-0002Gu-Fr for qemu-devel@nongnu.org; Tue, 02 Jul 2013 16:38:29 -0400 Message-ID: <51D33A40.3070903@weilnetz.de> Date: Tue, 02 Jul 2013 22:38:24 +0200 From: Stefan Weil MIME-Version: 1.0 References: <1371382385-20415-1-git-send-email-sw@weilnetz.de> <51D33918.3030108@weilnetz.de> In-Reply-To: <51D33918.3030108@weilnetz.de> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] savevm: Fix potential memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-trivial Cc: qemu-devel Am 02.07.2013 22:33, schrieb Stefan Weil: > Am 16.06.2013 13:33, schrieb Stefan Weil: >> The leak was reported by cppcheck. Fix it by moving the g_malloc0 after >> the argument validity check. >> >> Signed-off-by: Stefan Weil >> --- >> savevm.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/savevm.c b/savevm.c >> index 2ce439f..b883714 100644 >> --- a/savevm.c >> +++ b/savevm.c >> @@ -479,7 +479,7 @@ static const QEMUFileOps socket_write_ops = { >> >> QEMUFile *qemu_fopen_socket(int fd, const char *mode) >> { >> - QEMUFileSocket *s = g_malloc0(sizeof(QEMUFileSocket)); >> + QEMUFileSocket *s; >> >> if (mode == NULL || >> (mode[0] != 'r' && mode[0] != 'w') || >> @@ -488,6 +488,7 @@ QEMUFile *qemu_fopen_socket(int fd, const char *mode) >> return NULL; >> } >> >> + s = g_malloc0(sizeof(QEMUFileSocket)); >> s->fd = fd; >> if (mode[0] == 'w') { >> qemu_set_block(s->fd); > > Ping? Sorry, that was bad bookkeeping on my side. The patch was already applied. Stefan