aboutsummaryrefslogtreecommitdiff
path: root/net/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index f999c26597..aaf9be48e2 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -414,6 +414,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);
@@ -425,11 +426,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;