r13900: don't segfault on error
authorSimo Sorce <idra@samba.org>
Mon, 6 Mar 2006 21:40:47 +0000 (21:40 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:52:20 +0000 (13:52 -0500)
(This used to be commit cf7ad707578ee4dbd5dbf3c83f1f4ede42de3835)

source4/lib/ldb/common/ldb.c

index b664ba680d035905d1763642ca739e0d738eac96..4b4cc30de85fd4b6f0d616092670d80bd4a8b181 100644 (file)
@@ -305,10 +305,10 @@ int ldb_request(struct ldb_context *ldb, struct ldb_request *request)
        /* the search call is the only one that returns something
           other than a status code. We steal the results into
           the context of the ldb before freeing the request */
-       if (request->operation == LDB_REQ_SEARCH) {
+       if (status == LDB_SUCCESS && request->operation == LDB_REQ_SEARCH) {
                request->op.search.res = talloc_steal(ldb, r->op.search.res);
        }
-       if (request->operation == LDB_ASYNC_SEARCH) {
+       if (status == LDB_SUCCESS && request->operation == LDB_ASYNC_SEARCH) {
                request->async.handle = r->async.handle;
        }
        talloc_free(r);