Skip to content

Commit

Permalink
dialplan: prevent memory corruption when DB backend fails to start
Browse files Browse the repository at this point in the history
Fix a couple of incorrect free operations
  • Loading branch information
liviuchircu committed Aug 25, 2014
1 parent e0dcd97 commit b5ad64d
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions modules/dialplan/dp_db.c
Expand Up @@ -174,13 +174,6 @@ int init_data(void)
start->partition.len, start->partition.s);
dp_add_connection(start);

if (start->partition.s)
pkg_free(start->partition.s);
if (start->dp_db_url.s)
pkg_free(start->dp_db_url.s);
if (start->dp_table_name.s)
pkg_free(start->dp_table_name.s);

tmp = start;
}
pkg_free(tmp);
Expand Down Expand Up @@ -783,7 +776,7 @@ dp_connection_list_p dp_add_connection(dp_head_p head)

if (test_db(el) != 0) {
LM_ERR("Unable to test db\n");
pkg_free(el);
shm_free(el);
return NULL;
}

Expand Down

0 comments on commit b5ad64d

Please sign in to comment.