Received: from eggs.gnu.org ([208.118.235.92]:46077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEk2M-0002cb-T2 for qemu-devel@nongnu.org; Thu, 20 Sep 2012 12:55:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEk2L-0008S5-S0 for qemu-devel@nongnu.org; Thu, 20 Sep 2012 12:55:38 -0400 Message-ID: <505B4A85.3030600@weilnetz.de> Date: Thu, 20 Sep 2012 18:55:33 +0200 From: Stefan Weil MIME-Version: 1.0 References: <1346485226-26554-1-git-send-email-sw@weilnetz.de> In-Reply-To: <1346485226-26554-1-git-send-email-sw@weilnetz.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu-sockets: Fix potential memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-trivial Cc: Gerd Hoffmann , qemu-stable@nongnu.org, qemu-devel@nongnu.org Am 01.09.2012 09:40, schrieb Stefan Weil: > The old code leaks variable 'peer'. > > Signed-off-by: Stefan Weil > --- > qemu-sockets.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > Report from smatch: > qemu-sockets.c:404 inet_dgram_opts(101) warn: variable dereferenced before check 'peer' (see line 401) > > It looks like this warning does not make sense, but nevertheless > it helped me to discover the leak. > > Regards, > Stefan Weil > > diff --git a/qemu-sockets.c b/qemu-sockets.c > index 361d890..037775b 100644 > --- a/qemu-sockets.c > +++ b/qemu-sockets.c > @@ -353,7 +353,7 @@ int inet_dgram_opts(QemuOpts *opts) > if (0 != (rc = getaddrinfo(addr, port,&ai,&local))) { > fprintf(stderr,"getaddrinfo(%s,%s): %s\n", addr, port, > gai_strerror(rc)); > - return -1; > + goto err; > } > > /* create socket */ Ping? That code is from 2009, so the patch could also be applied to stable (even if the chance of getting that leak is small). Regards Stefan Weil