* [Qemu-devel] [PATCH] qemu-sockets: Fix potential memory leak
@ 2012-09-01 7:40 Stefan Weil
2012-09-20 16:55 ` Stefan Weil
2012-09-22 15:29 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2012-09-01 7:40 UTC (permalink / raw)
Cc: qemu-trivial, Stefan Weil, qemu-devel
The old code leaks variable 'peer'.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
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 */
--
1.7.10
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-sockets: Fix potential memory leak
2012-09-01 7:40 [Qemu-devel] [PATCH] qemu-sockets: Fix potential memory leak Stefan Weil
@ 2012-09-20 16:55 ` Stefan Weil
2012-09-22 15:29 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Weil @ 2012-09-20 16:55 UTC (permalink / raw)
To: qemu-trivial; +Cc: Gerd Hoffmann, qemu-stable, qemu-devel
Am 01.09.2012 09:40, schrieb Stefan Weil:
> The old code leaks variable 'peer'.
>
> Signed-off-by: Stefan Weil<sw@weilnetz.de>
> ---
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH] qemu-sockets: Fix potential memory leak
2012-09-01 7:40 [Qemu-devel] [PATCH] qemu-sockets: Fix potential memory leak Stefan Weil
2012-09-20 16:55 ` Stefan Weil
@ 2012-09-22 15:29 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2012-09-22 15:29 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-trivial, qemu-devel
On Sat, Sep 01, 2012 at 09:40:26AM +0200, Stefan Weil wrote:
> The old code leaks variable 'peer'.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> 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
Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-22 15:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-01 7:40 [Qemu-devel] [PATCH] qemu-sockets: Fix potential memory leak Stefan Weil
2012-09-20 16:55 ` Stefan Weil
2012-09-22 15:29 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).