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 4a6c66288f)
This commit is contained in:
Aram Sargsyan 2022-01-04 18:49:20 +00:00
parent b5735ec37a
commit 254cabb558

View 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);
}