From: Simo Sorce Date: Fri, 22 May 2009 01:32:17 +0000 (-0400) Subject: Insure we always return NULL on error. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c60539f31f63bd65e5b0e3ee16365f036bef3d5b;p=thirdparty%2Fsamba.git Insure we always return NULL on error. 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). --- diff --git a/source/lib/ldb/common/ldb.c b/source/lib/ldb/common/ldb.c index 743711b9672..c8aa6afdfc1 100644 --- a/source/lib/ldb/common/ldb.c +++ b/source/lib/ldb/common/ldb.c @@ -787,6 +787,7 @@ int ldb_search(struct ldb_context *ldb, done: if (ret != LDB_SUCCESS) { talloc_free(res); + res = NULL; } *_res = res;