From 469930053e26eeae6a0cd7a41595e619c4390e42 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Thu, 20 May 2010 22:42:29 -0400 Subject: [PATCH] tcp-bsd: Fix possible leak --- socket/tcp-bsd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/socket/tcp-bsd.c b/socket/tcp-bsd.c index bcc87be..1018430 100644 --- a/socket/tcp-bsd.c +++ b/socket/tcp-bsd.c @@ -91,7 +91,7 @@ nice_tcp_bsd_socket_new (NiceAgent *agent, GMainContext *ctx, NiceAddress *addr) int ret; struct sockaddr_storage name; guint name_len = sizeof (name); - NiceSocket *sock = g_slice_new0 (NiceSocket); + NiceSocket *sock; TcpPriv *priv; if (addr == NULL) { @@ -99,6 +99,8 @@ nice_tcp_bsd_socket_new (NiceAgent *agent, GMainContext *ctx, NiceAddress *addr) return NULL; } + sock = g_slice_new0 (NiceSocket); + nice_address_copy_to_sockaddr(addr, (struct sockaddr *)&name); if ((sockfd == -1) && -- 2.11.4.GIT