]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ldb-samba: avoid leak in dsdb_match_for_dns_to_tombstone_time
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 10 Mar 2021 03:30:16 +0000 (16:30 +1300)
committerJeremy Allison <jra@samba.org>
Tue, 30 Mar 2021 17:53:30 +0000 (17:53 +0000)
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 <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/ldb-samba/ldb_matching_rules.c

index 26f4d4ed3b510ad243fcc82fda02ac5b41fde61b..dc381854ab889e1482ce2601dabd0782bbbc49c7 100644 (file)
@@ -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;
                }