From: Andrew Bartlett Date: Mon, 26 Aug 2019 02:50:15 +0000 (+1200) Subject: ldb: Call TALLOC_FREE(filtered_msg->elements) on ldb_filter_attrs() failure X-Git-Tag: tevent-0.10.1~152 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1521a22f4366c86ec955cb9d32b7a758315d8ce0;p=thirdparty%2Fsamba.git ldb: Call TALLOC_FREE(filtered_msg->elements) on ldb_filter_attrs() failure Signed-off-by: Andrew Bartlett Reviewed-by: Gary Lockyer Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Tue Aug 27 01:16:33 UTC 2019 on sn-devel-184 --- diff --git a/lib/ldb/common/ldb_pack.c b/lib/ldb/common/ldb_pack.c index b5e1fbbc4ff..e7dd364008a 100644 --- a/lib/ldb/common/ldb_pack.c +++ b/lib/ldb/common/ldb_pack.c @@ -1256,5 +1256,6 @@ int ldb_filter_attrs(struct ldb_context *ldb, return 0; failed: + TALLOC_FREE(filtered_msg->elements); return -1; } diff --git a/lib/ldb/tests/ldb_filter_attrs_test.c b/lib/ldb/tests/ldb_filter_attrs_test.c index d04775879ac..7d555e0da2e 100644 --- a/lib/ldb/tests/ldb_filter_attrs_test.c +++ b/lib/ldb/tests/ldb_filter_attrs_test.c @@ -384,6 +384,7 @@ static void test_filter_attrs_two_dup_attr_matched_one_attr(void **state) /* This should fail the pidgenhole test */ assert_int_equal(ret, -1); + assert_null(filtered_msg->elements); } /* @@ -772,6 +773,7 @@ static void test_filter_attrs_one_attr_matched_star_no_dn(void **state) attrs, filtered_msg); assert_int_equal(ret, -1); + assert_null(filtered_msg->elements); } /*