[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32469 - msh/src
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32469 - msh/src |
Date: |
Mon, 24 Feb 2014 20:52:57 +0100 |
Author: harsha
Date: 2014-02-24 20:52:57 +0100 (Mon, 24 Feb 2014)
New Revision: 32469
Modified:
msh/src/addressmap.c
Log:
Invalidate references to InstanceAddressInfo object before freeing it.
Modified: msh/src/addressmap.c
===================================================================
--- msh/src/addressmap.c 2014-02-24 19:18:52 UTC (rev 32468)
+++ msh/src/addressmap.c 2014-02-24 19:52:57 UTC (rev 32469)
@@ -60,6 +60,12 @@
struct InstanceAddr *addr_tail;
/**
+ * The place pointer in the AddressMap if this object is added to it. This
is
+ * used to invalid the pointer from AddressMap when this object is freed.
+ */
+ struct InstanceAddrInfo **free_ptr;
+
+ /**
* Number of addresses in the above array
*/
unsigned int naddrs;
@@ -230,8 +236,13 @@
while (NULL != (addr = iainfo->addr_head))
{
GNUNET_CONTAINER_DLL_remove (iainfo->addr_head, iainfo->addr_tail, addr);
- free (addr);
+ instance_address_destroy (addr);
}
+ if (NULL != iainfo->free_ptr)
+ {
+ GNUNET_assert (iainfo == *iainfo->free_ptr);
+ *iainfo->free_ptr = NULL;
+ }
free (iainfo);
}
@@ -295,6 +306,7 @@
{
m->map[rank] = instance_address_info_create (rank);
iainfo = m->map[rank];
+ iainfo->free_ptr = &m->map[rank];
}
iaddr = instance_address_create_sockaddr_in (port, ip);
if (GNUNET_NO == instance_address_info_add_address (iainfo, iaddr))
@@ -328,10 +340,7 @@
GNUNET_assert (rank < m->size);
old = m->map[rank];
if (NULL == old)
- {
- m->map[rank] = new;
return GNUNET_SYSERR;
- }
old_ia = old->addr_head;
new_ia = new->addr_head;
n = 0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32469 - msh/src,
gnunet <=