aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorZhi Hui Li <zhihuili@linux.vnet.ibm.com>2011-11-24 16:23:00 +0800
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2011-12-06 09:56:41 +0000
commitc7ee8f683d93c7ea346a5eb86495da672ce7e7da (patch)
treed1ca9c82adc5ca0e8e568dc4260276512d3cae9a /net
parentb48e361194530539d3d420528b9c29a3287b77dd (diff)
net/socket.c : fix memory leak
Signed-off-by: Li Zhi Hui <zhihuili@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'net')
-rw-r--r--net/socket.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index e9ef12877f..0f091645ed 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -409,6 +409,7 @@ static int net_socket_listen_init(VLANState *vlan,
fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0) {
perror("socket");
+ g_free(s);
return -1;
}
socket_set_nonblock(fd);
@@ -420,11 +421,13 @@ static int net_socket_listen_init(VLANState *vlan,
ret = bind(fd, (struct sockaddr *)&saddr, sizeof(saddr));
if (ret < 0) {
perror("bind");
+ g_free(s);
return -1;
}
ret = listen(fd, 0);
if (ret < 0) {
perror("listen");
+ g_free(s);
return -1;
}
s->vlan = vlan;