From: Douglas Bagnall Date: Wed, 10 Mar 2021 03:30:16 +0000 (+1300) Subject: ldb-samba: avoid leak in dsdb_match_for_dns_to_tombstone_time X-Git-Tag: tevent-0.11.0~1344 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=56483a2799430d36dcb9036b8a6f5eece959ba9f;p=thirdparty%2Fsamba.git ldb-samba: avoid leak in dsdb_match_for_dns_to_tombstone_time After the first time through the loop, tmp_ctx has been freed and NULLed, so we end up allocating on NULL and never freeing. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14659 Signed-off-by: Douglas Bagnall Reviewed-by: Jeremy Allison --- diff --git a/lib/ldb-samba/ldb_matching_rules.c b/lib/ldb-samba/ldb_matching_rules.c index 26f4d4ed3b5..dc381854ab8 100644 --- a/lib/ldb-samba/ldb_matching_rules.c +++ b/lib/ldb-samba/ldb_matching_rules.c @@ -428,20 +428,20 @@ static int dsdb_match_for_dns_to_tombstone_time(struct ldb_context *ldb, } if (rec->wType == DNS_TYPE_SOA || rec->wType == DNS_TYPE_NS) { - TALLOC_FREE(tmp_ctx); + TALLOC_FREE(rec); continue; } if (rec->wType == DNS_TYPE_TOMBSTONE) { - TALLOC_FREE(tmp_ctx); + TALLOC_FREE(rec); continue; } if (rec->dwTimeStamp == 0) { - TALLOC_FREE(tmp_ctx); + TALLOC_FREE(rec); continue; } if (rec->dwTimeStamp > tombstone_time) { - TALLOC_FREE(tmp_ctx); + TALLOC_FREE(rec); continue; }