From 44f9f5cf5846213dacba1821229c97941e1646a3 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 4 May 2025 15:13:06 +0200 Subject: [PATCH] init_domain_components(): Assert that the http->dbuffer and http->dvec are NULL To detect memory leaks earlier. --- urlmatch.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.49.0