From 0f0162e6297ddf5e4abe848d27f3bcdb373189da Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Wed, 3 Nov 1999 16:52:28 +0000 Subject: [PATCH] cleanup of a reference leak --- lib/dns/tsig.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c index 39e60251c6..e3c26546a0 100644 --- a/lib/dns/tsig.c +++ b/lib/dns/tsig.c @@ -16,7 +16,7 @@ */ /* - * $Id: tsig.c,v 1.30 1999/11/02 23:40:05 bwelling Exp $ + * $Id: tsig.c,v 1.31 1999/11/03 16:52:28 bwelling Exp $ * Principal Author: Brian Wellington */ @@ -588,22 +588,23 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg) { } /* Find dns_tsigkey_t based on keyname */ - ret = dns_tsigkey_find(&tsigkey, keyname, &tsig->algorithm); - if (ret != ISC_R_SUCCESS) { - msg->tsigstatus = dns_tsigerror_badkey; - msg->tsigkey = NULL; - /* - * this key must be deleted later - an empty key can be found - * by calling dns_tsigkey_empty() - */ - ret = dns_tsigkey_create(keyname, &tsig->algorithm, NULL, 0, - ISC_FALSE, NULL, mctx, &msg->tsigkey); - if (ret != ISC_R_SUCCESS) - goto cleanup_struct; - return (DNS_R_TSIGVERIFYFAILURE); + if (msg->tsigkey == NULL) { + ret = dns_tsigkey_find(&tsigkey, keyname, &tsig->algorithm); + if (ret != ISC_R_SUCCESS) { + msg->tsigstatus = dns_tsigerror_badkey; + msg->tsigkey = NULL; + ret = dns_tsigkey_create(keyname, &tsig->algorithm, + NULL, 0, ISC_FALSE, NULL, + mctx, &msg->tsigkey); + if (ret != ISC_R_SUCCESS) + goto cleanup_struct; + return (DNS_R_TSIGVERIFYFAILURE); + } + msg->tsigkey = tsigkey; } + else + tsigkey = msg->tsigkey; - msg->tsigkey = tsigkey; key = tsigkey->key; /* Is the time ok? */