bind/bind-9.5-dbus-leak.patch

64 lines
1.7 KiB
Diff
Raw Normal View History

Written-by: Adam Tkac <atkac@redhat.com>
diff -up bind-9.5.0a6/contrib/dbus/dbus_mgr.c.leak bind-9.5.0a6/contrib/dbus/dbus_mgr.c
--- bind-9.5.0a6/contrib/dbus/dbus_mgr.c.leak 2007-05-10 07:47:02.000000000 +0200
+++ bind-9.5.0a6/contrib/dbus/dbus_mgr.c 2007-10-18 13:32:19.000000000 +0200
@@ -167,6 +167,9 @@ dbus_mgr_init_dbus(ns_dbus_mgr_t *);
static isc_result_t
dbus_mgr_record_initial_fwdtable(ns_dbus_mgr_t *);
+static
+dns_fwdtable_t *dbus_mgr_get_fwdtable(void);
+
static void
dbus_mgr_free_initial_fwdtable(ns_dbus_mgr_t *);
@@ -272,6 +275,8 @@ dbus_mgr_create
return ISC_R_SUCCESS;
cleanup_mgr:
+ if ( dbus_mgr_get_fwdtable() != NULL)
+ dbus_mgr_free_initial_fwdtable (mgr);
if( mgr->task != 0L )
isc_task_detach(&(mgr->task));
isc_mem_put(mctx, mgr, sizeof(*mgr));
@@ -623,7 +628,7 @@ static void dbus_mgr_record_initial_forw
dns_name_init(&(ifwdr->dn), NULL);
if( dns_name_dupwithoffsets(name, mgr->mctx, &(ifwdr->dn)) != ISC_R_SUCCESS )
- return;
+ goto namedup_err;
ISC_LIST_INIT(ifwdr->sa);
@@ -634,14 +639,27 @@ static void dbus_mgr_record_initial_forw
{
nsa = isc_mem_get(mgr->mctx, sizeof(isc_sockaddr_t));
if( nsa == 0L )
- return;
+ goto nsa_err;
*nsa = *sa;
ISC_LINK_INIT(nsa, link);
ISC_LIST_APPEND(ifwdr->sa, nsa, link);
}
ISC_LINK_INIT(ifwdr, link);
tsearch( ifwdr, &(mgr->ifwdt), dbus_mgr_ifwdr_comparator);
-}
+
+ return;
+
+nsa_err:
+ while ( (sa = ISC_LIST_HEAD (ifwdr->sa)) != NULL) {
+ ISC_LIST_UNLINK (ifwdr->sa, sa, link);
+ isc_mem_put (mgr->mctx, sa, sizeof (*sa));
+ }
+
+namedup_err:
+ isc_mem_put (mgr->mctx, ifwdr, sizeof (*ifwdr));
+
+ return;
+}
static isc_result_t
dbus_mgr_record_initial_fwdtable( ns_dbus_mgr_t *mgr )