check origrouter before freeing
diff --git a/nlsr_sync.c b/nlsr_sync.c
index a7a130c..4130b9f 100644
--- a/nlsr_sync.c
+++ b/nlsr_sync.c
@@ -145,14 +145,10 @@
get_name_part(struct name_prefix *name_part,struct ccn_charbuf * interest_ccnb,
struct ccn_indexbuf *interest_comps, int offset)
{
-
-
-
int i;
int lsa_position=0;
int len=0;
-
struct ccn_indexbuf cid={0};
struct ccn_indexbuf *components=&cid;
struct ccn_charbuf *name=ccn_charbuf_create();
@@ -162,7 +158,6 @@
ccn_charbuf_destroy(&name);
-
const unsigned char *comp_ptr1;
size_t comp_size;
for(i=lsa_position+1+offset;i<interest_comps->n-1;i++)
@@ -553,7 +548,8 @@
}
}
- free(orig_router);
+ if (orig_router)
+ free(orig_router);
ccn_charbuf_destroy(&uri);
//01/31/2013
free(time_stamp);