- fixed missing va_end () functions (#336601)

- fixed memory leak when dbus initialization fails
This commit is contained in:
Adam Tkac 2007-10-18 17:45:07 +00:00
parent edea69c54e
commit bbe5776b48
3 changed files with 101 additions and 1 deletions

63
bind-9.5-dbus-leak.patch Normal file
View File

@ -0,0 +1,63 @@
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 )

View File

@ -0,0 +1,29 @@
Written-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Adam Tkac <atkac@redhat.com>
--- bind-9.5.0a6/contrib/dbus/dbus_service.c.va_end 2007-10-17 14:55:10.000000000 -0400
+++ bind-9.5.0a6/contrib/dbus/dbus_service.c 2007-10-17 14:56:20.000000000 -0400
@@ -200,6 +200,7 @@ dbus_svc_add_filter
}
}
}
+ va_end(va);
return( 1 );
}
@@ -424,6 +425,7 @@ dbus_svc_message_append_args(DBusConnect
if( !dbus_message_append_args_valist( msg, firstType, va ) )
{
if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_send: dbus_message_append_args failed");
+ va_end(va);
return 0;
}
va_end(va);
@@ -488,6 +490,7 @@ dbus_svc_call
va_end(va);
return(0L);
}
+ va_end(va);
return reply;
}

View File

@ -21,7 +21,7 @@ Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv
Name: bind
License: ISC
Version: 9.5.0
Release: 15.%{RELEASEVER}%{?dist}
Release: 15.1.%{RELEASEVER}%{?dist}
Epoch: 32
Url: http://www.isc.org/products/BIND/
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -79,6 +79,8 @@ Patch17: bind-9.3.2b1-fix_sdb_ldap.patch
# D-BUS patches
Patch15: bind-9.5.0-dbus.patch
Patch23: bind-9.5-dbus_archdep_libdir.patch
Patch81: bind-9.5-dbus-leak.patch
Patch82: bind-9.5-dbus-va_end.patch
# IDN paches
Patch73: bind-9.5-libidn.patch
@ -221,6 +223,8 @@ cp -fp contrib/sdb/sqlite/zone2sqlite.c bin/sdb_tools
%if %{WITH_DBUS}
%patch15 -p1 -b .dbus
%patch23 -p1 -b .dbus_archdep_libdir
%patch81 -p1 -b .leak
%patch82 -p1 -b .va_end
%endif
%if %{SDB}
%patch17 -p1 -b .fix_sdb_ldap
@ -645,6 +649,10 @@ rm -rf ${RPM_BUILD_ROOT}
%{_sbindir}/bind-chroot-admin
%changelog
* Wed Oct 18 2007 Adam Tkac <atkac redhat com> 32:9.5.0-15.1.a6
- fixed missing va_end () functions (#336601)
- fixed memory leak when dbus initialization fails
* Tue Oct 16 2007 Adam Tkac <atkac redhat com> 32:9.5.0-15.a6
- corrected named.5 SDB statement (#326051)