lib ldb common: Fix memory leak ldb-2.1.0
authorGary Lockyer <gary@catalyst.net.nz>
Tue, 14 Jan 2020 01:42:26 +0000 (14:42 +1300)
committerGary Lockyer <gary@samba.org>
Wed, 15 Jan 2020 19:58:41 +0000 (19:58 +0000)
TALLOC_FREE the ldb_control allocated in ldb_parse_control_from_string
when none of the cases match.

Credit to OSS-Fuzz

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: David Disseldorp <ddiss@samba.org>
lib/ldb/common/ldb_controls.c

index 8a727f74e6e6da7467f8689a667cbab43ee51d06..4af06a436ab78419bd9f993727e371b65f87722b 100644 (file)
@@ -1282,6 +1282,7 @@ struct ldb_control *ldb_parse_control_from_string(struct ldb_context *ldb, TALLO
        /*
         * When no matching control has been found.
         */
+       TALLOC_FREE(ctrl);
        return NULL;
 }