[samba4/f17] Fix possible memory leaks in the samba master process.

asn asn at fedoraproject.org
Tue Jun 12 14:16:03 UTC 2012


commit 027834459ee8530ebe8809b3deb33ff925ec7a04
Author: Andreas Schneider <asn at cryptomilk.org>
Date:   Tue Jun 12 15:46:09 2012 +0200

    Fix possible memory leaks in the samba master process.

 ...a4-4.0.0-beta1-fix-s3-daemon-memory-leaks.patch |  106 ++++++++++++++++++++
 samba4.spec                                        |    6 +
 2 files changed, 112 insertions(+), 0 deletions(-)
---
diff --git a/samba4-4.0.0-beta1-fix-s3-daemon-memory-leaks.patch b/samba4-4.0.0-beta1-fix-s3-daemon-memory-leaks.patch
new file mode 100644
index 0000000..1082ba0
--- /dev/null
+++ b/samba4-4.0.0-beta1-fix-s3-daemon-memory-leaks.patch
@@ -0,0 +1,106 @@
+commit 8fd02fa2d6bdedbda1657a15f602bb4384367251
+Author:     Jeremy Allison <jra at samba.org>
+AuthorDate: Thu May 31 15:06:58 2012 -0700
+Commit:     Jeremy Allison <jra at samba.org>
+CommitDate: Thu May 31 16:08:44 2012 -0700
+
+    Forward port of Richard Sharpe's <realrichardsharpe at gmail.com> fix for bug #8970 - Possible memory leaks in the samba master process.
+---
+ source3/nmbd/nmbd.c          |    3 ++-
+ source3/param/loadparm.c     |    6 +++++-
+ source3/printing/load.c      |    7 ++++++-
+ source3/smbd/server_reload.c |    1 +
+ source3/winbindd/winbindd.c  |    3 ++-
+ 5 files changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
+index 98a5310..d464e7e 100644
+--- a/source3/nmbd/nmbd.c
++++ b/source3/nmbd/nmbd.c
+@@ -382,11 +382,12 @@ static bool reload_nmbd_services(bool test)
+ 	set_remote_machine_name("nmbd", False);
+ 
+ 	if ( lp_loaded() ) {
+-		const char *fname = lp_configfile();
++		char *fname = lp_configfile();
+ 		if (file_exist(fname) && !strcsequal(fname,get_dyn_CONFIGFILE())) {
+ 			set_dyn_CONFIGFILE(fname);
+ 			test = False;
+ 		}
++		TALLOC_FREE(fname);
+ 	}
+ 
+ 	if ( test && !lp_file_list_changed() )
+diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
+index 11ff646..1c78b58 100644
+--- a/source3/param/loadparm.c
++++ b/source3/param/loadparm.c
+@@ -8809,7 +8809,11 @@ static bool lp_load_ex(const char *pszFname,
+ 		}
+ 	}
+ 
+-	lp_add_auto_services(lp_auto_services());
++	{
++		char *serv = lp_auto_services();
++		lp_add_auto_services(serv);
++		TALLOC_FREE(serv);
++	}
+ 
+ 	if (add_ipc) {
+ 		/* When 'restrict anonymous = 2' guest connections to ipc$
+diff --git a/source3/printing/load.c b/source3/printing/load.c
+index 161d711..af4dcc7 100644
+--- a/source3/printing/load.c
++++ b/source3/printing/load.c
+@@ -31,6 +31,7 @@ static void add_auto_printers(void)
+ 	int pnum = lp_servicenumber(PRINTERS_NAME);
+ 	char *str;
+ 	char *saveptr;
++	char *auto_serv = NULL;
+ 
+ 	if (pnum < 0)
+ 		if (process_registry_service(PRINTERS_NAME))
+@@ -39,8 +40,12 @@ static void add_auto_printers(void)
+ 	if (pnum < 0)
+ 		return;
+ 
+-	if ((str = SMB_STRDUP(lp_auto_services())) == NULL)
++	auto_serv = lp_auto_services();
++	str = SMB_STRDUP(auto_serv);
++	TALLOC_FREE(auto_serv);
++	if (str == NULL) {
+ 		return;
++	}
+ 
+ 	for (p = strtok_r(str, LIST_SEP, &saveptr); p;
+ 	     p = strtok_r(NULL, LIST_SEP, &saveptr)) {
+diff --git a/source3/smbd/server_reload.c b/source3/smbd/server_reload.c
+index 8ca5bee7..bab622d 100644
+--- a/source3/smbd/server_reload.c
++++ b/source3/smbd/server_reload.c
+@@ -146,6 +146,7 @@ bool reload_services(struct smbd_server_connection *sconn,
+ 			set_dyn_CONFIGFILE(fname);
+ 			test = False;
+ 		}
++		TALLOC_FREE(fname);
+ 	}
+ 
+ 	reopen_logs();
+diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
+index 22056e2..248f747 100644
+--- a/source3/winbindd/winbindd.c
++++ b/source3/winbindd/winbindd.c
+@@ -65,11 +65,12 @@ static bool reload_services_file(const char *lfile)
+ 	bool ret;
+ 
+ 	if (lp_loaded()) {
+-		const char *fname = lp_configfile();
++		char *fname = lp_configfile();
+ 
+ 		if (file_exist(fname) && !strcsequal(fname,get_dyn_CONFIGFILE())) {
+ 			set_dyn_CONFIGFILE(fname);
+ 		}
++		TALLOC_FREE(fname);
+ 	}
+ 
+ 	/* if this is a child, restore the logfile to the special
diff --git a/samba4.spec b/samba4.spec
index 2213d1d..b6909d2 100644
--- a/samba4.spec
+++ b/samba4.spec
@@ -78,6 +78,7 @@ Patch4: samba4-external_ldap_callback.patch
 Patch5: samba4-4.0.0-alpha19-CVE-2012-1182.patch
 Patch6: samba4-4.0.0-alpha20-lib-private.patch
 Patch7: samba4-CVE-2012-2111.patch
+Patch8: samba4-4.0.0-beta1-fix-s3-daemon-memory-leaks.patch
 
 BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
@@ -361,6 +362,7 @@ link against the SMB, RPC and other protocols.
 %patch5 -p1 -b .CVE-2012-1182
 %patch6 -p1 -b .private-lib
 %patch7 -p1 -b .CVE-2012-2111
+%patch8 -p1 -b .daemon_mem_leaks
 
 %build
 %define _talloc_lib %nil
@@ -1230,6 +1232,10 @@ rm -rf %{buildroot}
 %endif # with_libwbclient
 
 %changelog
+* Tue Jun 12 2012 Andreas Schneider <asn at redhat.com> - 2:4.0.0-53.alpha21
+- Fix possible memory leaks in the samba master process.
+- resolves: #829694
+
 * Mon Jun 04 2012 Andreas Schneider <asn at redhat.com> - 2:4.0.0-52.alpha21
 - Add missing conflict for samba-swat.
 - Move some common binaries from client to common subpackage.


More information about the scm-commits mailing list