Commit 177d97c1 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune Committed by Nils Goroll

vsb: Harden destroy and fini operations

They either take both a dynamic struct and buffer, or both are static.
parent 33330796
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment