[master] 9168ee5ed help flexelint understand what happens with memory
Nils Goroll
nils.goroll at uplex.de
Sat Apr 4 11:12:11 UTC 2020
commit 9168ee5edc83fecc1ac2d2ec27ecd4edeef1ff90
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Sat Apr 4 12:39:52 2020 +0200
help flexelint understand what happens with memory
Flexelint sput warning 429 that the malloc() return value was neither
freed not returned.
This simplification makes it clear. The assertion on malloc() having
succeeded is in VSA_Build()
Ref #3275
diff --git a/lib/libvarnish/vsa.c b/lib/libvarnish/vsa.c
index a2cab79df..03a2ed3e4 100644
--- a/lib/libvarnish/vsa.c
+++ b/lib/libvarnish/vsa.c
@@ -245,12 +245,7 @@ socklen_t sua_len(const struct sockaddr *sa)
struct suckaddr *
VSA_Malloc(const void *s, unsigned sal)
{
- void *d;
-
- d = malloc(vsa_suckaddr_len);
- AN(d);
-
- return (VSA_Build(d, s, sal));
+ return (VSA_Build(malloc(vsa_suckaddr_len), s, sal));
}
/* 'd' SHALL point to vsa_suckaddr_len aligned bytes of storage
More information about the varnish-commit
mailing list