From: David Hankins Date: Tue, 27 Mar 2007 03:08:13 +0000 (+0000) Subject: - A memory leak in the minires_nsendsigned() function call was repaired. X-Git-Tag: v4_0_0a1~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d69fb6a8d49346971434bf4a66b451e69c63bfc6;p=thirdparty%2Fdhcp.git - A memory leak in the minires_nsendsigned() function call was repaired. Effectively, this leaked ~80 bytes per DDNS update. [ISC-Bugs #16770] --- diff --git a/RELNOTES b/RELNOTES index f7695797a..f44956cfb 100644 --- a/RELNOTES +++ b/RELNOTES @@ -195,6 +195,9 @@ the README file. - A reference leak on binding scopes set by ddns updates was repaired. +- A memory leak in the minires_nsendsigned() function call was repaired. + Effectively, this leaked ~80 bytes per DDNS update. + Changes since 3.0.5rc1 - A bug was repaired in fixes to the dhclient, which sought to run the diff --git a/minires/res_sendsigned.c b/minires/res_sendsigned.c index 240454214..b80ffe514 100644 --- a/minires/res_sendsigned.c +++ b/minires/res_sendsigned.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -67,8 +67,10 @@ res_nsendsigned(res_state statp, bufsize = msglen + 1024; newmsg = (double *) malloc(bufsize); - if (newmsg == NULL) + if (newmsg == NULL) { + free(nstatp); return ISC_R_NOMEMORY; + } memcpy(newmsg, msg, msglen); newmsglen = msglen; @@ -91,6 +93,7 @@ res_nsendsigned(res_state statp, NOERROR, dstkey, NULL, 0, sig, &siglen, 0); if (rcode != ISC_R_SUCCESS) { + dst_free_key(dstkey); free (nstatp); free (newmsg); return rcode; @@ -107,6 +110,7 @@ retry: rcode = res_nsend(nstatp, newmsg, newmsglen, answer, anslen, &ret); if (rcode != ISC_R_SUCCESS) { + dst_free_key(dstkey); free (nstatp); free (newmsg); return rcode; @@ -119,6 +123,7 @@ retry: if (rcode != ISC_R_SUCCESS) { Dprint(nstatp->pfcode & RES_PRF_REPLY, (stdout, ";; TSIG invalid (%s)\n", p_rcode(ret))); + dst_free_key(dstkey); free (nstatp); free (newmsg); return rcode; @@ -132,6 +137,7 @@ retry: goto retry; } + dst_free_key(dstkey); free (nstatp); free (newmsg); *anssize = anslen;