Memory Leak Reduction
This commit is contained in:
1 parent
aa2adc14fc
commit
0b60ba975c
5 files changed
+15
-11
No files matched your search
@@ -478,8 +478,8 @@ process_command_logdir(char *command)
|
||||
printf(" Wrong Command Format ( logdir /path/to/logdir/ )\n");
|
||||
return;
|
||||
}
|
||||
if ( nlsr->logDir)
|
||||
free(nlsr->logDir);
|
||||
//if ( nlsr->logDir)
|
||||
//free(nlsr->logDir);
|
||||
nlsr->logDir=(char *)calloc(strlen(dir)+1,sizeof(char));
|
||||
memcpy(nlsr->logDir,dir,strlen(dir)+1);
|
||||
}
|
||||
|
||||
+4
-2
@@ -688,9 +688,10 @@ get_host_name_from_command_string(struct name_prefix *name_part,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
struct ccn_indexbuf cid={0};
|
||||
//struct ccn_indexbuf cid={0};
|
||||
|
||||
struct ccn_indexbuf *components=&cid;
|
||||
//struct ccn_indexbuf *components=&cid;
|
||||
struct ccn_indexbuf *components=ccn_indexbuf_create();
|
||||
ccn_name_split (name, components);
|
||||
|
||||
for(i=components->n-2;i> (0+offset);i--)
|
||||
@@ -721,6 +722,7 @@ get_host_name_from_command_string(struct name_prefix *name_part,
|
||||
// 01/31/2013
|
||||
free(neighbor);
|
||||
ccn_charbuf_destroy(&name);
|
||||
ccn_indexbuf_destroy(&components);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -903,8 +903,8 @@ install_adj_lsa(struct alsa * adj_lsa)
|
||||
|
||||
new_adj_lsa->no_link=adj_lsa->no_link;
|
||||
|
||||
if(new_adj_lsa->body )
|
||||
free(new_adj_lsa->body);
|
||||
//if(new_adj_lsa->body )
|
||||
//free(new_adj_lsa->body);
|
||||
new_adj_lsa->body=(char *)calloc(strlen(adj_lsa->body)+1,sizeof(char));
|
||||
//memset(new_adj_lsa->body,0,strlen(adj_lsa->body)+1);
|
||||
memcpy(new_adj_lsa->body,adj_lsa->body,strlen(adj_lsa->body)+1);
|
||||
|
||||
+3
-3
@@ -50,9 +50,9 @@ route_calculate(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_
|
||||
print_routing_table();
|
||||
print_npt();
|
||||
|
||||
struct hashtb_param param_me = {0};
|
||||
nlsr->map = hashtb_create(sizeof(struct map_entry), ¶m_me);
|
||||
nlsr->rev_map = hashtb_create(sizeof(struct map_entry), ¶m_me);
|
||||
//struct hashtb_param param_me = {0};
|
||||
nlsr->map = hashtb_create(sizeof(struct map_entry), NULL);
|
||||
nlsr->rev_map = hashtb_create(sizeof(struct map_entry), NULL);
|
||||
make_map();
|
||||
assign_mapping_number();
|
||||
print_map();
|
||||
|
||||
+4
-2
@@ -124,8 +124,9 @@ get_name_part(struct name_prefix *name_part,struct ccn_charbuf * interest_ccnb,
|
||||
int lsa_position=0;
|
||||
//int len=0;
|
||||
|
||||
struct ccn_indexbuf cid={0};
|
||||
struct ccn_indexbuf *components=&cid;
|
||||
//struct ccn_indexbuf cid={0};
|
||||
//struct ccn_indexbuf *components=&cid;
|
||||
struct ccn_indexbuf *components=ccn_indexbuf_create();
|
||||
struct ccn_charbuf *name=ccn_charbuf_create();
|
||||
ccn_name_from_uri(name,nlsr->slice_prefix);
|
||||
ccn_name_split (name, components);
|
||||
@@ -147,6 +148,7 @@ get_name_part(struct name_prefix *name_part,struct ccn_charbuf * interest_ccnb,
|
||||
|
||||
ccn_charbuf_destroy(&temp1);
|
||||
ccn_charbuf_destroy(&temp);
|
||||
ccn_indexbuf_destroy(&components);
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("Name Part: %s \n",name_part->name);
|
||||
|
||||
Reference in new issue
Block a user