svn commit: r314627 - head/contrib/ipfilter/lib

Cy Schubert cy at FreeBSD.org
Fri Mar 3 21:32:29 UTC 2017


Author: cy
Date: Fri Mar  3 21:32:27 2017
New Revision: 314627
URL: https://svnweb.freebsd.org/changeset/base/314627

Log:
  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

Modified:
  head/contrib/ipfilter/lib/save_v2trap.c

Modified: head/contrib/ipfilter/lib/save_v2trap.c
==============================================================================
--- head/contrib/ipfilter/lib/save_v2trap.c	Fri Mar  3 21:03:28 2017	(r314626)
+++ head/contrib/ipfilter/lib/save_v2trap.c	Fri Mar  3 21:32:27 2017	(r314627)
@@ -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;
 


More information about the svn-src-head mailing list