mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-25 02:42:33 -05:00
3440. [bug] Reorder get_key_struct to not trigger a assertion when
cleaning up due to out of memory error. [RT #32131]
This commit is contained in:
parent
f0058a25b0
commit
fcc04c160f
2 changed files with 13 additions and 9 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
3440. [bug] Reorder get_key_struct to not trigger a assertion when
|
||||
cleaning up due to out of memory error. [RT #32131]
|
||||
|
||||
3439. [placeholder]
|
||||
|
||||
3438. [bug] Don't accept unknown data escape in quotes. [RT #32031]
|
||||
|
|
|
|||
|
|
@ -1326,24 +1326,24 @@ get_key_struct(dns_name_t *name, unsigned int alg,
|
|||
return (NULL);
|
||||
|
||||
memset(key, 0, sizeof(dst_key_t));
|
||||
key->magic = KEY_MAGIC;
|
||||
|
||||
result = isc_refcount_init(&key->refs, 1);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_mem_put(mctx, key, sizeof(dst_key_t));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
key->key_name = isc_mem_get(mctx, sizeof(dns_name_t));
|
||||
if (key->key_name == NULL) {
|
||||
isc_refcount_destroy(&key->refs);
|
||||
isc_mem_put(mctx, key, sizeof(dst_key_t));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
dns_name_init(key->key_name, NULL);
|
||||
result = dns_name_dup(name, mctx, key->key_name);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_refcount_destroy(&key->refs);
|
||||
isc_mem_put(mctx, key->key_name, sizeof(dns_name_t));
|
||||
isc_mem_put(mctx, key, sizeof(dst_key_t));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
result = isc_refcount_init(&key->refs, 1);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_name_free(key->key_name, mctx);
|
||||
isc_mem_put(mctx, key->key_name, sizeof(dns_name_t));
|
||||
isc_mem_put(mctx, key, sizeof(dst_key_t));
|
||||
return (NULL);
|
||||
|
|
@ -1363,6 +1363,7 @@ get_key_struct(dns_name_t *name, unsigned int alg,
|
|||
key->times[i] = 0;
|
||||
key->timeset[i] = ISC_FALSE;
|
||||
}
|
||||
key->magic = KEY_MAGIC;
|
||||
return (key);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue