Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Nov 2011 17:02:27 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r227893 - head/usr.sbin/mfiutil
Message-ID:  <201111231702.pANH2R24054741@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Wed Nov 23 17:02:27 2011
New Revision: 227893
URL: http://svn.freebsd.org/changeset/base/227893

Log:
  Avoid double free creating a new RAID with invalid command line arguments.
  
  Submitted by:	Xin Huang <xhuang sandvine com>
  Reviewed by:	rstone@
  MFC after:	1 week

Modified:
  head/usr.sbin/mfiutil/mfi_config.c

Modified: head/usr.sbin/mfiutil/mfi_config.c
==============================================================================
--- head/usr.sbin/mfiutil/mfi_config.c	Wed Nov 23 16:03:47 2011	(r227892)
+++ head/usr.sbin/mfiutil/mfi_config.c	Wed Nov 23 17:02:27 2011	(r227893)
@@ -348,6 +348,7 @@ parse_array(int fd, int raid_type, char 
 		error = mfi_lookup_drive(fd, cp, &device_id);
 		if (error) {
 			free(info->drives);
+			info->drives = NULL;
 			return (error);
 		}
 
@@ -355,12 +356,14 @@ parse_array(int fd, int raid_type, char 
 			error = errno;
 			warn("Failed to fetch drive info for drive %s", cp);
 			free(info->drives);
+			info->drives = NULL;
 			return (error);
 		}
 
 		if (pinfo->fw_state != MFI_PD_STATE_UNCONFIGURED_GOOD) {
 			warnx("Drive %u is not available", device_id);
 			free(info->drives);
+			info->drives = NULL;
 			return (EINVAL);
 		}
 	}



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