Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Mar 2017 05:35:14 +0000 (UTC)
From:      Cy Schubert <cy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r314834 - in stable: 10/contrib/ipfilter/lib 11/contrib/ipfilter/lib
Message-ID:  <201703070535.v275ZEqc072030@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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/11/contrib/ipfilter/lib/save_v2trap.c
Directory Properties:
  stable/11/   (props changed)

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

Modified: stable/11/contrib/ipfilter/lib/save_v2trap.c
==============================================================================
--- stable/11/contrib/ipfilter/lib/save_v2trap.c	Tue Mar  7 05:10:38 2017	(r314833)
+++ stable/11/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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703070535.v275ZEqc072030>