Commit fcc04c16 authored by Mark Andrews's avatar Mark Andrews
Browse files

3440. [bug] Reorder get_key_struct to not trigger a assertion when

                        cleaning up due to out of memory error. [RT #32131]
parent f0058a25
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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment