Patchwork [03/14] qemu-sockets: Fix potential memory leak

login
register
mail settings
Submitter Stefan Hajnoczi
Date Sept. 23, 2012, 10 a.m.
Message ID <1348394420-28298-4-git-send-email-stefanha@gmail.com>
Download mbox | patch
Permalink /patch/186197/
State New
Headers show

Comments

Stefan Hajnoczi - Sept. 23, 2012, 10 a.m.
From: Stefan Weil <sw@weilnetz.de>

The old code leaks variable 'peer'.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
---
 qemu-sockets.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

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 */