[Pkg-telepathy-commits] [libnice] 88/265: socket: Ensure variables are nullified correctly in UDP sockets

Simon McVittie smcv at debian.org
Wed May 14 12:04:56 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository libnice.

commit bdc72e7898292a8fd32a53cd0e3de8996673daed
Author: Philip Withnall <philip.withnall at collabora.co.uk>
Date:   Fri Jan 3 15:02:33 2014 +0000

    socket: Ensure variables are nullified correctly in UDP sockets
    
    When closing a socket, ensure its private data structure is set to NULL.
    When sending a message fails to construct a new socket address, ensure
    the pointer to the old address (which has just been unreffed) is removed.
    
    This makes debugging problems with sockets being freed early much
    easier.
---
 socket/udp-bsd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/socket/udp-bsd.c b/socket/udp-bsd.c
index 721da00..efa82f7 100644
--- a/socket/udp-bsd.c
+++ b/socket/udp-bsd.c
@@ -158,6 +158,7 @@ socket_close (NiceSocket *sock)
   if (priv->gaddr)
     g_object_unref (priv->gaddr);
   g_slice_free (struct UdpBsdSocketPrivate, sock->priv);
+  sock->priv = NULL;
 
   if (sock->fileno) {
     g_socket_close (sock->fileno, NULL);
@@ -218,9 +219,9 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
       g_object_unref (priv->gaddr);
     nice_address_copy_to_sockaddr (to, &sa.addr);
     gaddr = g_socket_address_new_from_native (&sa.addr, sizeof(sa));
+    priv->gaddr = gaddr;
     if (gaddr == NULL)
       return -1;
-    priv->gaddr = gaddr;
     priv->niceaddr = *to;
   }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git



More information about the Pkg-telepathy-commits mailing list