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:
Cy Schubert 2017-03-03 21:32:27 +00:00
parent 8a8bea603c
commit 56d5bb4c63

View File

@ -124,8 +124,10 @@ snmpv2_parse(char **strings)
str = strdup(*strings);
ctx = calloc(1, sizeof(*ctx));
if (ctx == NULL)
if (ctx == NULL) {
free(str);
return NULL;
}
ctx->fd = -1;