dynbuf: assert init on free

Add a DEBUGASSERT() in Curl_dyn_free() that checks that Curl_dyn_init()
has been performed before.

Fix code places that did it wrong.

Fixes #16725
Closes #16775
This commit is contained in:
Stefan Eissing 2025-03-20 10:31:30 +01:00 committed by Daniel Stenberg
parent cd7eb9e0f2
commit 646b2d6ca2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
17 changed files with 222 additions and 163 deletions

View file

@ -60,6 +60,7 @@ void Curl_dyn_init(struct dynbuf *s, size_t toobig)
void Curl_dyn_free(struct dynbuf *s)
{
DEBUGASSERT(s);
DEBUGASSERT(s->init == DYNINIT);
Curl_safefree(s->bufr);
s->leng = s->allc = 0;
}