From: Aram Sargsyan Date: Tue, 4 Jan 2022 18:49:20 +0000 (+0000) Subject: Fix a memory leak in dns_dlzcreate() X-Git-Tag: v9.19.0~146^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4a6c66288ff831a3450e6472605d3ef8d668eac7;p=thirdparty%2Fbind9.git Fix a memory leak in dns_dlzcreate() dns_dlzcreate() fails to free the memory allocated for dlzname when an error occurs. Free dlzname's memory (acquired earlier with isc_mem_strdup()) by calling isc_mem_free() before returning an error code. --- diff --git a/lib/dns/dlz.c b/lib/dns/dlz.c index 9b28e37f7a9..b2ff6a6b178 100644 --- a/lib/dns/dlz.c +++ b/lib/dns/dlz.c @@ -230,6 +230,7 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername, /* impinfo->methods->create failed. */ RWUNLOCK(&dlz_implock, isc_rwlocktype_read); + isc_mem_free(mctx, db->dlzname); isc_mem_put(mctx, db, sizeof(dns_dlzdb_t)); return (result); }