Codebase list libnice / bdc72e7
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. Philip Withnall authored 10 years ago Olivier CrĂȘte committed 10 years ago
1 changed file(s) with 2 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
157157 if (priv->gaddr)
158158 g_object_unref (priv->gaddr);
159159 g_slice_free (struct UdpBsdSocketPrivate, sock->priv);
160 sock->priv = NULL;
160161
161162 if (sock->fileno) {
162163 g_socket_close (sock->fileno, NULL);
217218 g_object_unref (priv->gaddr);
218219 nice_address_copy_to_sockaddr (to, &sa.addr);
219220 gaddr = g_socket_address_new_from_native (&sa.addr, sizeof(sa));
221 priv->gaddr = gaddr;
220222 if (gaddr == NULL)
221223 return -1;
222 priv->gaddr = gaddr;
223224 priv->niceaddr = *to;
224225 }
225226