Free Some Unfreed Memory
diff --git a/nlsr_km.c b/nlsr_km.c
index 6ac2817..3aa706b 100644
--- a/nlsr_km.c
+++ b/nlsr_km.c
@@ -147,10 +147,12 @@
return -1;
}
+ ccn_keystore_destroy(&keystore);
ccn_charbuf_destroy(&sp.template_ccnb);
ccn_charbuf_destroy(&keyid);
ccn_charbuf_destroy(&keyname);
ccn_charbuf_destroy(&pubid_out);
+
free(baseuri);
return 0;
}
diff --git a/nlsr_km_util.c b/nlsr_km_util.c
index 72e9d8b..94b3816 100644
--- a/nlsr_km_util.c
+++ b/nlsr_km_util.c
@@ -249,6 +249,8 @@
memcpy(router,ccn_charbuf_as_string(temp1),
strlen(ccn_charbuf_as_string(temp1)));
router[strlen(router)]='\0';
+ ccn_charbuf_destroy(&temp1);
+ ccn_charbuf_destroy(&orig_router);
}
else{
ccn_indexbuf_destroy(&name_comps);
diff --git a/nlsr_ndn.c b/nlsr_ndn.c
index 46e493a..a0967a1 100644
--- a/nlsr_ndn.c
+++ b/nlsr_ndn.c
@@ -80,7 +80,7 @@
}
- nbr->name=(char *)malloc(strlen(neighbor)+1);
+ nbr->name=(char *)calloc(strlen(neighbor)+1,sizeof(char));
memcpy(nbr->name,neighbor,strlen(neighbor)+1);
nbr->length=strlen(neighbor)+1;
@@ -359,6 +359,7 @@
//ccn_charbuf_destroy(&sp.template_ccnb);
//ccn_charbuf_destroy(&pubid);
//ccn_charbuf_destroy(&pubkey);
+ ccn_charbuf_destroy(&resultbuf);
}
//ccn_charbuf_destroy(&data);
@@ -670,7 +671,10 @@
}
}
- free(nbr);
+ if ( nbr->name != NULL )
+ free(nbr->name);
+ if ( nbr != NULL )
+ free(nbr);
}