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);
                }
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to