Insure we always return NULL on error.
authorSimo Sorce <idra@samba.org>
Fri, 22 May 2009 01:32:17 +0000 (21:32 -0400)
committerKarolin Seeger <kseeger@samba.org>
Tue, 2 Jun 2009 10:41:56 +0000 (12:41 +0200)
It is not technically an ldb bug, but apparently some callers try to access
res before checking the ldb_search() return code.
So make their attempt very evident (a NULL dereference will make it cristal
clear where the bug is).
(cherry picked from commit c60539f31f63bd65e5b0e3ee16365f036bef3d5b)

source/lib/ldb/common/ldb.c

index 743711b9672ca73a482767a855c7dc9db439d2a6..c8aa6afdfc131cc08f9f6caf9f9081a5e709a112 100644 (file)
@@ -787,6 +787,7 @@ int ldb_search(struct ldb_context *ldb,
 done:
        if (ret != LDB_SUCCESS) {
                talloc_free(res);
+               res = NULL;
        }
 
        *_res = res;