svn commit: r314834 - in stable: 10/contrib/ipfilter/lib 11/contrib/ipfilter/lib

Cy Schubert cy at FreeBSD.org
Tue Mar 7 05:35:16 UTC 2017


Author: cy
Date: Tue Mar  7 05:35:14 2017
New Revision: 314834
URL: https://svnweb.freebsd.org/changeset/base/314834

Log:
  MFC r314627:
  
  Fix leak (free str before returning when ctx's calloc fails).
  
  Submitted by:	trix_juniper.net (Tom Rix)
  Reviewed by:	cy, ngie
  Discovered by:	clang's static analyzer
  Differential Revision:	D9877

Modified:
  stable/10/contrib/ipfilter/lib/save_v2trap.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/ipfilter/lib/save_v2trap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/contrib/ipfilter/lib/save_v2trap.c
==============================================================================
--- stable/10/contrib/ipfilter/lib/save_v2trap.c	Tue Mar  7 05:10:38 2017	(r314833)
+++ stable/10/contrib/ipfilter/lib/save_v2trap.c	Tue Mar  7 05:35:14 2017	(r314834)
@@ -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-stable-10 mailing list