From 5504e5d066cdaa1b4c0c57db1a19ece175d2a1bd Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Thu, 19 Oct 2000 01:38:26 +0000 Subject: [PATCH] A few isc_mem_strdup() failures weren't handled well. --- lib/dns/config/confkeys.c | 7 ++++++- lib/dns/config/conflwres.c | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/dns/config/confkeys.c b/lib/dns/config/confkeys.c index 08aa10add1..f0b591733d 100644 --- a/lib/dns/config/confkeys.c +++ b/lib/dns/config/confkeys.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: confkeys.c,v 1.27 2000/08/01 01:23:21 tale Exp $ */ +/* $Id: confkeys.c,v 1.28 2000/10/19 01:38:25 bwelling Exp $ */ #include @@ -244,6 +244,7 @@ dns_c_kdef_new(isc_mem_t *mem, const char *name, dns_c_kdef_t **keyid) kd->keyid = isc_mem_strdup(mem, name); if (kd->keyid == NULL) { isc_mem_put(mem, kd, sizeof *kd); + return (ISC_R_NOMEMORY); } kd->magic = DNS_C_KDEF_MAGIC; @@ -600,6 +601,10 @@ dns_c_kid_new(isc_mem_t *mem, const char *name, dns_c_kid_t **keyid) ki->magic = DNS_C_KEYID_MAGIC; ki->mem = mem; ki->keyid = isc_mem_strdup(mem, name); + if (ki->keyid == NULL) { + isc_mem_put(mem, ki, sizeof *ki); + return (ISC_R_NOMEMORY); + } ISC_LINK_INIT(ki, next); diff --git a/lib/dns/config/conflwres.c b/lib/dns/config/conflwres.c index d67a49246a..35a13b5793 100644 --- a/lib/dns/config/conflwres.c +++ b/lib/dns/config/conflwres.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: conflwres.c,v 1.4 2000/10/19 01:26:36 gson Exp $ */ +/* $Id: conflwres.c,v 1.5 2000/10/19 01:38:26 bwelling Exp $ */ #include @@ -394,6 +394,10 @@ dns_c_search_new(isc_mem_t *mem, const char *val, dns_c_search_t **search) ki->magic = DNS_C_SEARCH_MAGIC; ki->mem = mem; ki->search = isc_mem_strdup(mem, val); + if (ki->search == NULL) { + isc_mem_put(mem, ki, sizeof *ki); + return (ISC_R_NOMEMORY); + } ISC_LINK_INIT(ki, next);