From: Fabian Keil <fk@fabiankeil.de>
Date: Sun, 4 May 2025 13:13:06 +0000 (+0200)
Subject: init_domain_components(): Assert that the http->dbuffer and http->dvec are NULL
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/developer-manual/man-page/@default-cgi@/static//%22%22?a=commitdiff_plain;p=privoxy.git

init_domain_components(): Assert that the http->dbuffer and http->dvec are NULL

To detect memory leaks earlier.
---

diff --git a/urlmatch.c b/urlmatch.c
index b213c3eb..7682c9e0 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -122,6 +122,7 @@ jb_err init_domain_components(struct http_request *http)
    size_t size;
    char *p;
 
+   assert(http->dbuffer == NULL);
    http->dbuffer = strdup_or_die(http->host);
 
    /* map to lower case */
@@ -146,6 +147,7 @@ jb_err init_domain_components(struct http_request *http)
    /* save a copy of the pointers in dvec */
    size = (size_t)http->dcount * sizeof(*http->dvec);
 
+   assert(http->dvec == NULL);
    http->dvec = malloc_or_die(size);
 
    memcpy(http->dvec, vec, size);