2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

fix a memory leak on a tsig error condition.

This commit is contained in:
Brian Wellington
2001-09-11 22:34:21 +00:00
parent 36c1674e0a
commit 6eeefeb3eb

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dighost.c,v 1.222 2001/08/29 18:57:08 gson Exp $ */ /* $Id: dighost.c,v 1.223 2001/09/11 22:34:21 bwelling Exp $ */
/* /*
* Notice to programmers: Do not use this code as an example of how to * Notice to programmers: Do not use this code as an example of how to
@@ -966,6 +966,9 @@ try_clear_lookup(dig_lookup_t *lookup) {
if (lookup->sendspace != NULL) if (lookup->sendspace != NULL)
isc_mempool_put(commctx, lookup->sendspace); isc_mempool_put(commctx, lookup->sendspace);
if (lookup->tsigctx != NULL)
dst_context_destroy(&lookup->tsigctx);
isc_mem_free(mctx, lookup); isc_mem_free(mctx, lookup);
return (ISC_TRUE); return (ISC_TRUE);
} }
@@ -2282,6 +2285,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
result = dns_message_settsigkey(msg, key); result = dns_message_settsigkey(msg, key);
check_result(result, "dns_message_settsigkey"); check_result(result, "dns_message_settsigkey");
msg->tsigctx = l->tsigctx; msg->tsigctx = l->tsigctx;
l->tsigctx = NULL;
if (l->msgcounter != 0) if (l->msgcounter != 0)
msg->tcp_continuation = 1; msg->tcp_continuation = 1;
l->msgcounter++; l->msgcounter++;
@@ -2361,6 +2365,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
validated = ISC_FALSE; validated = ISC_FALSE;
} }
l->tsigctx = msg->tsigctx; l->tsigctx = msg->tsigctx;
msg->tsigctx = NULL;
if (l->querysig != NULL) { if (l->querysig != NULL) {
debug("freeing querysig buffer %p", l->querysig); debug("freeing querysig buffer %p", l->querysig);
isc_buffer_free(&l->querysig); isc_buffer_free(&l->querysig);