]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix a memory leak in dns_dlzcreate()
authorAram Sargsyan <aram@isc.org>
Tue, 4 Jan 2022 18:49:20 +0000 (18:49 +0000)
committerAram Sargsyan <aram@isc.org>
Tue, 25 Jan 2022 08:21:50 +0000 (08:21 +0000)
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.

lib/dns/dlz.c

index 9b28e37f7a97b2e0dded11dd315d0fd602a49dab..b2ff6a6b178af57078a77673305c8c3cbc44d326 100644 (file)
@@ -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);
 }