- Fix memory leak in out-of-memory conditions of local zone add.

git-svn-id: file:///svn/unbound/trunk@3717 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2016-05-06 06:56:51 +00:00
parent ac506c5a20
commit 455a681204
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,6 @@
6 May 2016: Wouter
- Fix memory leak in out-of-memory conditions of local zone add.
29 April 2016: Wouter
- Fix sldns with static checking fixes copied from getdns.

View file

@ -172,6 +172,7 @@ lz_enter_zone_dname(struct local_zones* zones, uint8_t* nm, size_t len,
{
struct local_zone* z = local_zone_create(nm, len, labs, t, c);
if(!z) {
free(nm);
log_err("out of memory");
return NULL;
}
@ -1275,7 +1276,10 @@ struct local_zone* local_zones_add_zone(struct local_zones* zones,
{
/* create */
struct local_zone* z = local_zone_create(name, len, labs, tp, dclass);
if(!z) return NULL;
if(!z) {
free(name);
return NULL;
}
lock_rw_wrlock(&z->lock);
/* find the closest parent */