Browse code

memset() was sometimes bypassed for some reason in dns_cache_clone_entry()

Miklos Tirpak authored on 13/08/2007 14:33:57
Showing 1 changed files
... ...
@@ -3458,6 +3458,7 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e, in
3458 3458
 		LOG(L_ERR, "ERROR: dns_cache_clone_entry: out of memory\n");
3459 3459
 		return NULL;
3460 3460
 	}
3461
+	memset(new, 0, rounded_size+rr_size+rdata_size);
3461 3462
 	/* clone the entry */
3462 3463
 	memcpy(new, e, size);
3463 3464
 	/* fix the values and pointers */
... ...
@@ -3500,8 +3501,6 @@ static struct dns_hash_entry *dns_cache_clone_entry(struct dns_hash_entry *e, in
3500 3500
 
3501 3501
 
3502 3502
 	if (rdata_size) {
3503
-		memset(new+size, 0, rounded_size-size+rr_size+rdata_size);
3504
-
3505 3503
 		/* set the pointer to the new rr structure */
3506 3504
 		new_rr = (void*)((char*)new + rounded_size);
3507 3505
 		new_rr->rdata = (void*)((char*)new_rr+rr_size);