ldb:"ldb_extended" -make the call more similar to "ldb_search"
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Tue, 21 Jun 2011 20:25:22 +0000 (22:25 +0200)
committerAndrew Tridgell <tridge@samba.org>
Mon, 19 Sep 2011 00:57:03 +0000 (10:57 +1000)
For example NULL out the LDB result pointer on failures.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
lib/ldb/common/ldb.c

index 433f30b7c194f387c7df011fa08f6be1f6afd4e5..a4c04cec4614871877b8b13a1517265602ac60a4 100644 (file)
@@ -1417,6 +1417,7 @@ int ldb_extended(struct ldb_context *ldb,
        struct ldb_result *res;
 
        *_res = NULL;
+       req = NULL;
 
        res = talloc_zero(ldb, struct ldb_result);
        if (!res) {
@@ -1427,6 +1428,8 @@ int ldb_extended(struct ldb_context *ldb,
                                     oid, data, NULL,
                                     res, ldb_extended_default_callback,
                                     NULL);
+       ldb_req_set_location(req, "ldb_extended");
+
        if (ret != LDB_SUCCESS) goto done;
 
        ldb_set_timeout(ldb, req, 0); /* use default timeout */
@@ -1437,13 +1440,14 @@ int ldb_extended(struct ldb_context *ldb,
                ret = ldb_wait(req->handle, LDB_WAIT_ALL);
        }
 
-       talloc_free(req);
-
 done:
        if (ret != LDB_SUCCESS) {
                talloc_free(res);
+               res = NULL;
        }
 
+       talloc_free(req);
+
        *_res = res;
        return ret;
 }