From aeca99a602869de2d2cbd0815b52eab2214a46a2 Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Sat, 3 Jun 2000 00:43:46 +0000 Subject: [PATCH] Don't dereference a pointer before assigning it. --- lib/dns/sec/dst/dst_api.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/dns/sec/dst/dst_api.c b/lib/dns/sec/dst/dst_api.c index 42f0f5f2dd..8dc5d6f2b4 100644 --- a/lib/dns/sec/dst/dst_api.c +++ b/lib/dns/sec/dst/dst_api.c @@ -19,7 +19,7 @@ /* * Principal Author: Brian Wellington - * $Id: dst_api.c,v 1.45 2000/06/02 23:44:52 bwelling Exp $ + * $Id: dst_api.c,v 1.46 2000/06/03 00:43:46 bwelling Exp $ */ #include @@ -249,9 +249,6 @@ dst_key_fromfile(dns_name_t *name, const isc_uint16_t id, if (dst_algorithm_supported(alg) == ISC_FALSE) return (DST_R_UNSUPPORTEDALG); - if (key->func->fromfile == NULL) - return (DST_R_UNSUPPORTEDALG); - if ((type & (DST_TYPE_PRIVATE | DST_TYPE_PUBLIC)) == 0) return (DST_R_UNSUPPORTEDTYPE); @@ -277,6 +274,11 @@ dst_key_fromfile(dns_name_t *name, const isc_uint16_t id, if (key == NULL) return (ISC_R_NOMEMORY); + if (key->func->fromfile == NULL) { + dst_key_free(&key); + return (DST_R_UNSUPPORTEDALG); + } + ret = key->func->fromfile(key, id); if (ret != ISC_R_SUCCESS) { dst_key_free(&key);