Fix leak (free str before returning when ctx's calloc fails).
Submitted by: trix_juniper.net (Tom Rix) Discovered by: clang's static analyzer MFC after: 4 days Relnotes: ngie Differential Revision: D9877
This commit is contained in:
parent
8a8bea603c
commit
56d5bb4c63
@ -124,8 +124,10 @@ snmpv2_parse(char **strings)
|
|||||||
str = strdup(*strings);
|
str = strdup(*strings);
|
||||||
|
|
||||||
ctx = calloc(1, sizeof(*ctx));
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
if (ctx == NULL)
|
if (ctx == NULL) {
|
||||||
|
free(str);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ctx->fd = -1;
|
ctx->fd = -1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user