svn commit: samba r25755 - in branches/SAMBA_4_0/source: dsdb/samdb/ldb_modules lib/ldb/common

abartlet at samba.org abartlet at samba.org
Tue Oct 30 23:35:05 GMT 2007


Author: abartlet
Date: 2007-10-30 23:35:04 +0000 (Tue, 30 Oct 2007)
New Revision: 25755

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25755

Log:
Fix a couple of memory leaks, in particular a new leak onto the NULL
context caused by my objectclass module work.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/objectclass.c
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/objectclass.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/objectclass.c	2007-10-30 21:03:54 UTC (rev 25754)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/objectclass.c	2007-10-30 23:35:04 UTC (rev 25755)
@@ -389,7 +389,7 @@
 	/* return or own handle to deal with this call */
 	req->handle = h;
 
-	parent_dn = ldb_dn_get_parent(ac->search_req, ac->orig_req->op.mod.message->dn);
+	parent_dn = ldb_dn_get_parent(ac, ac->orig_req->op.mod.message->dn);
 	if (parent_dn == NULL) {
 		ldb_oom(module->ldb);
 		return LDB_ERR_OPERATIONS_ERROR;
@@ -403,6 +403,8 @@
 		return ret;
 	}
 
+	talloc_steal(ac->search_req, parent_dn);
+
 	ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->search_req);
 
 	ac->step = OC_SEARCH_ADD_PARENT;
@@ -873,7 +875,7 @@
 	/* return or own handle to deal with this call */
 	req->handle = h;
 
-	parent_dn = ldb_dn_get_parent(ac->search_req, ac->orig_req->op.rename.newdn);
+	parent_dn = ldb_dn_get_parent(ac, ac->orig_req->op.rename.newdn);
 	if (parent_dn == NULL) {
 		ldb_oom(module->ldb);
 		return LDB_ERR_OPERATIONS_ERROR;
@@ -886,7 +888,7 @@
 	if (ret != LDB_SUCCESS) {
 		return ret;
 	}
-
+	talloc_steal(ac->search_req, parent_dn);
 	ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->search_req);
 
 	ac->step = OC_SEARCH_RENAME_PARENT;

Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c	2007-10-30 21:03:54 UTC (rev 25754)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c	2007-10-30 23:35:04 UTC (rev 25755)
@@ -347,15 +347,17 @@
 
 	if (modules != NULL) {
 		ret = ldb_load_modules_list(ldb, modules, ldb->modules, &ldb->modules);
-		talloc_free(modules);
 		if (ret != LDB_SUCCESS) {
+			talloc_free(mem_ctx);
 			return ret;
 		}
 	} else {
 		ldb_debug(ldb, LDB_DEBUG_TRACE, "No modules specified for this database");
 	}
 
-	return ldb_init_module_chain(ldb, ldb->modules);
+	ret = ldb_init_module_chain(ldb, ldb->modules);
+	talloc_free(mem_ctx);
+	return ret;
 }
 
 /*



More information about the samba-cvs mailing list