Skip to content

Commit

Permalink
nathelper/usrloc: Fix shm memleak
Browse files Browse the repository at this point in the history
  • Loading branch information
liviuchircu committed Mar 28, 2018
1 parent ff93986 commit b7934ad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/nathelper/sip_pinger.h
Expand Up @@ -234,6 +234,7 @@ build_branch(char *branch, int *size,
struct ping_cell *p_cell;
struct nh_table *htable;
struct timeval timeval_st;
int dangling_coords = 0;

/* we want all contact pings from a contact in one bucket*/
hash_id = core_hash(curi, 0, 0) & (NH_TABLE_ENTRIES-1);
Expand All @@ -251,6 +252,8 @@ build_branch(char *branch, int *size,
goto out_memfault;
}
insert_into_hash(p_cell);
} else {
dangling_coords = 1;
}

p_cell->timestamp = timestamp;
Expand Down Expand Up @@ -301,6 +304,9 @@ build_branch(char *branch, int *size,
goto out_nospace;
}

if (dangling_coords)
ul.free_ucontact_coords(ct_coords);

*branch = '\0';

return 0;
Expand Down

0 comments on commit b7934ad

Please sign in to comment.