diff options
author | Andrej Gessel <Andrej.Gessel@janztec.com> | 2018-06-14 12:19:29 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-06-26 09:19:17 +0200 |
commit | 7ccd1eb5393f76642a96db0037d9f4b3bb10709a (patch) | |
tree | 3c1b8d9baea6a0ee273827db46bfa185a99249ab /lib | |
parent | 2a3f91ea027eb1d24568b96036801d3f9e5a13f2 (diff) | |
download | samba-7ccd1eb5393f76642a96db0037d9f4b3bb10709a.tar.gz |
Fix several mem leaks in ldb_index ldb_search ldb_tdb
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13475
Signed-off-by: Andrej Gessel <Andrej.Gessel@janztec.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jun 15 23:07:25 CEST 2018 on sn-devel-144
(cherry picked from commit 3ca1c09f686fbfa9257cd95710dba4a98c3eeb8f)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ldb/ldb_tdb/ldb_index.c | 4 | ||||
-rw-r--r-- | lib/ldb/ldb_tdb/ldb_search.c | 7 | ||||
-rw-r--r-- | lib/ldb/ldb_tdb/ldb_tdb.c | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c index 340e5c72550..40baeea5c2b 100644 --- a/lib/ldb/ldb_tdb/ldb_index.c +++ b/lib/ldb/ldb_tdb/ldb_index.c @@ -403,6 +403,7 @@ normal_index: "expected %d for %s", version, LTDB_INDEXING_VERSION, ldb_dn_get_linearized(dn)); + talloc_free(msg); return LDB_ERR_OPERATIONS_ERROR; } @@ -420,14 +421,17 @@ normal_index: "expected %d for %s", version, LTDB_GUID_INDEXING_VERSION, ldb_dn_get_linearized(dn)); + talloc_free(msg); return LDB_ERR_OPERATIONS_ERROR; } if (el->num_values != 1) { + talloc_free(msg); return LDB_ERR_OPERATIONS_ERROR; } if ((el->values[0].length % LTDB_GUID_SIZE) != 0) { + talloc_free(msg); return LDB_ERR_OPERATIONS_ERROR; } diff --git a/lib/ldb/ldb_tdb/ldb_search.c b/lib/ldb/ldb_tdb/ldb_search.c index fdae4cba62b..02890862cf7 100644 --- a/lib/ldb/ldb_tdb/ldb_search.c +++ b/lib/ldb/ldb_tdb/ldb_search.c @@ -408,7 +408,7 @@ int ltdb_filter_attrs(TALLOC_CTX *mem_ctx, /* Shortcuts for the simple cases */ } else if (add_dn && i == 1) { if (msg_add_distinguished_name(msg2) != 0) { - return -1; + goto failed; } *filtered_msg = msg2; return 0; @@ -474,7 +474,7 @@ int ltdb_filter_attrs(TALLOC_CTX *mem_ctx, if (add_dn) { if (msg_add_distinguished_name(msg2) != 0) { - return -1; + goto failed; } } @@ -483,7 +483,7 @@ int ltdb_filter_attrs(TALLOC_CTX *mem_ctx, struct ldb_message_element, msg2->num_elements); if (msg2->elements == NULL) { - return -1; + goto failed; } } else { talloc_free(msg2->elements); @@ -494,6 +494,7 @@ int ltdb_filter_attrs(TALLOC_CTX *mem_ctx, return 0; failed: + TALLOC_FREE(msg2); return -1; } diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c index f2d179c7db6..701427609e9 100644 --- a/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/lib/ldb/ldb_tdb/ldb_tdb.c @@ -434,6 +434,7 @@ int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flg } if (ltdb->read_only) { + talloc_free(tdb_key_ctx); return LDB_ERR_UNWILLING_TO_PERFORM; } @@ -657,6 +658,7 @@ int ltdb_delete_noindex(struct ldb_module *module, } if (ltdb->read_only) { + talloc_free(tdb_key_ctx); return LDB_ERR_UNWILLING_TO_PERFORM; } |