svn commit: samba r15176 - in branches/SAMBA_4_0/source/lib/ldb/common: .

abartlet at samba.org abartlet at samba.org
Sun Apr 23 11:25:03 GMT 2006


Author: abartlet
Date: 2006-04-23 11:25:02 +0000 (Sun, 23 Apr 2006)
New Revision: 15176

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

Log:
Ensure we don't segfault when we try and delete @FOO records.

Don't try and steal the result of a search on failure, it has already
been talloc_free()'ed by the ildb code.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb.c	2006-04-23 11:16:01 UTC (rev 15175)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb.c	2006-04-23 11:25:02 UTC (rev 15176)
@@ -244,6 +244,10 @@
 
 int ldb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type)
 {
+	if (!handle) {
+		return LDB_SUCCESS;
+	}
+
 	return handle->module->ops->async_wait(handle, type);
 }
 
@@ -308,9 +312,9 @@
 /*
   search the database given a LDAP-like search expression
 
-  return the number of records found, or -1 on error
+  returns an LDB error code
 
-  Use talloc_free to free the ldb_message returned in 'res'
+  Use talloc_free to free the ldb_message returned in 'res', if successful
 
 */
 int ldb_search(struct ldb_context *ldb, 
@@ -346,9 +350,10 @@
 	req->controls = NULL;
 
 	ret = ldb_request(ldb, req);
-
-	(*res) = talloc_steal(ldb, req->op.search.res);
-
+	
+	if (ret == LDB_SUCCESS) {
+		(*res) = talloc_steal(ldb, req->op.search.res);
+	}
 	talloc_free(req);
 	return ret;
 }



More information about the samba-cvs mailing list