Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Apr 2014 21:13:33 +0000 (UTC)
From:      Christian Brueffer <brueffer@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264421 - head/sys/netpfil/ipfw
Message-ID:  <201404132113.s3DLDXRI044236@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brueffer
Date: Sun Apr 13 21:13:33 2014
New Revision: 264421
URL: http://svnweb.freebsd.org/changeset/base/264421

Log:
  Free resources and error cases; re-indent a curly brace while here.
  
  CID:		1199366
  Found with:	Coverity Prevent(tm)
  MFC after:	1 week

Modified:
  head/sys/netpfil/ipfw/ip_fw_sockopt.c

Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_sockopt.c	Sun Apr 13 20:21:56 2014	(r264420)
+++ head/sys/netpfil/ipfw/ip_fw_sockopt.c	Sun Apr 13 21:13:33 2014	(r264421)
@@ -1039,8 +1039,10 @@ ipfw_ctl(struct sockopt *sopt)
 		if (sopt->sopt_valsize == RULESIZE7(rule)) {
 		    is7 = 1;
 		    error = convert_rule_to_8(rule);
-		    if (error)
+		    if (error) {
+			free(rule, M_TEMP);
 			return error;
+		    }
 		    if (error == 0)
 			error = check_ipfw_struct(rule, RULESIZE(rule));
 		} else {
@@ -1056,11 +1058,13 @@ ipfw_ctl(struct sockopt *sopt)
 				if (is7) {
 					error = convert_rule_to_7(rule);
 					size = RULESIZE7(rule);
-					if (error)
+					if (error) {
+						free(rule, M_TEMP);
 						return error;
+					}
 				}
 				error = sooptcopyout(sopt, rule, size);
-		}
+			}
 		}
 		free(rule, M_TEMP);
 		break;



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