Deep Cleaning ADL, NPL
diff --git a/nlsr_adl.c b/nlsr_adl.c
index 6076f89..3a68ce1 100644
--- a/nlsr_adl.c
+++ b/nlsr_adl.c
@@ -399,11 +399,13 @@
if (res == HT_OLD_ENTRY)
{
struct ndn_neighbor *nbr=e->data;
- free(nbr->neighbor->name);
+ /*free(nbr->neighbor->name);
free(nbr->neighbor);
free(nbr->last_lsdb_version);
free(nbr->last_info_version);
free(nbr->ip_address);
+ */
+ destroy_nbr_component(nbr);
hashtb_delete(e);
}
@@ -724,3 +726,45 @@
}
+void
+destroy_nbr_component(struct ndn_neighbor *nbr)
+{
+ if ( nbr->neighbor->name )
+ free(nbr->neighbor->name);
+ if ( nbr->neighbor )
+ free(nbr->neighbor);
+ if ( nbr->last_lsdb_version)
+ free(nbr->last_lsdb_version);
+ if ( nbr->last_info_version)
+ free(nbr->last_info_version);
+ if ( nbr->ip_address)
+ free(nbr->ip_address);
+}
+
+void
+destroy_adl(void)
+{
+ int i, adl_element;
+ struct ndn_neighbor *nbr;
+
+ struct hashtb_enumerator ee;
+ struct hashtb_enumerator *e = ⅇ
+
+ hashtb_start(nlsr->adl, e);
+ adl_element=hashtb_n(nlsr->adl);
+
+ for(i=0;i<adl_element;i++)
+ {
+ nbr=e->data;
+ destroy_nbr_component(nbr);
+ hashtb_next(e);
+ }
+
+ hashtb_end(e);
+
+ if( nlsr->adl )
+ hashtb_destroy(&nlsr->adl);
+
+}
+
+