Author: tsoome
Date: Fri Dec 20 08:15:55 2019
New Revision: 355929
URL: https://svnweb.freebsd.org/changeset/base/355929

Log:
  MFC r355702:
  loader: vdisk dereference after free
  
  print out the information and then free the memory used.

Modified:
  stable/12/stand/common/vdisk.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/vdisk.c
==============================================================================
--- stable/12/stand/common/vdisk.c      Fri Dec 20 08:12:44 2019        
(r355928)
+++ stable/12/stand/common/vdisk.c      Fri Dec 20 08:15:55 2019        
(r355929)
@@ -229,10 +229,10 @@ command_unmapvd(int argc, char *argv[])
        }
 
        STAILQ_REMOVE(&vdisk_list, vd, vdisk_info, vdisk_link);
-       close(vd->vdisk_fd);
+       (void) close(vd->vdisk_fd);
+       printf("%s (%s) unmapped\n", argv[1], vd->vdisk_path);
        free(vd->vdisk_path);
        free(vd);
-       printf("%s (%s) unmapped\n", argv[1], vd->vdisk_path);
 
        return (CMD_OK);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to