[master] 177d97c1a vsb: Harden destroy and fini operations
Nils Goroll
nils.goroll at uplex.de
Mon Oct 5 13:46:06 UTC 2020
commit 177d97c1a193494a30dbaeb5dfdf09e309655cd0
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Mon Sep 14 11:39:15 2020 +0200
vsb: Harden destroy and fini operations
They either take both a dynamic struct and buffer, or both are static.
diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c
index 0cbc66305..0a185c9d6 100644
--- a/lib/libvarnish/vsb.c
+++ b/lib/libvarnish/vsb.c
@@ -529,6 +529,7 @@ VSB_fini(struct vsb *s)
assert_VSB_integrity(s);
assert(!VSB_ISDYNAMIC(s));
+ assert(!VSB_ISDYNSTRUCT(s));
memset(s, 0, sizeof(*s));
}
@@ -539,6 +540,7 @@ VSB_destroy(struct vsb **s)
AN(s);
assert_VSB_integrity(*s);
assert(VSB_ISDYNAMIC(*s));
+ assert(VSB_ISDYNSTRUCT(*s));
SBFREE((*s)->s_buf);
memset(*s, 0, sizeof(**s));
SBFREE(*s);
More information about the varnish-commit
mailing list