bind/backport-0012-Fix-a-memory-leak-in-dns_dlzcreate.patch
2023-01-09 16:44:23 +08:00

34 lines
1.0 KiB
Diff

From 254cabb558cc6152ae892d2a71e65f7cedbd1a38 Mon Sep 17 00:00:00 2001
From: Aram Sargsyan <aram@isc.org>
Date: Tue, 4 Jan 2022 18:49:20 +0000
Subject: [PATCH] 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.
(cherry picked from commit 4a6c66288ff831a3450e6472605d3ef8d668eac7)
Conflict: NA
Reference: https://gitlab.isc.org/isc-projects/bind9/-/commit/254cabb558cc6152ae892d2a71e65f7cedbd1a38
---
lib/dns/dlz.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/dns/dlz.c b/lib/dns/dlz.c
index cc0b17e5d2..20e3f545bf 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);
}
--
2.23.0