Fixup rrset unlock in case of allocation failure.

git-svn-id: file:///svn/unbound/trunk@3381 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2015-03-26 13:15:55 +00:00
parent b2bdce46be
commit 06fa21b0da

View file

@ -305,9 +305,10 @@ rrset_array_unlock_touch(struct rrset_cache* r, struct regional* scratch,
hashvalue_t* h;
size_t i;
if(count > RR_COUNT_MAX || !(h = (hashvalue_t*)regional_alloc(scratch,
sizeof(hashvalue_t)*count)))
sizeof(hashvalue_t)*count))) {
log_warn("rrset LRU: memory allocation failed");
else /* store hash values */
h = NULL;
} else /* store hash values */
for(i=0; i<count; i++)
h[i] = ref[i].key->entry.hash;
/* unlock */