Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 May 2013 00:40:27 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r250894 - head/sys/ufs/ffs
Message-ID:  <201305220040.r4M0eRUT036079@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mckusick
Date: Wed May 22 00:40:26 2013
New Revision: 250894
URL: http://svnweb.freebsd.org/changeset/base/250894

Log:
  Null a pointer after it is freed so that when it is returned
  the return value is NULL. Based on the returned flags, the
  return value should never be inspected in the case where NULL
  is returned, but it is good coding practice not to return a
  pointer to freed memory.
  
  Found by:    Coverity Scan, CID 1006096
  Reviewed by: kib
  MFC after:   2 weeks

Modified:
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- head/sys/ufs/ffs/ffs_softdep.c	Wed May 22 00:31:33 2013	(r250893)
+++ head/sys/ufs/ffs/ffs_softdep.c	Wed May 22 00:40:26 2013	(r250894)
@@ -8150,6 +8150,7 @@ setup_newdir(dap, newinum, dinum, newdir
 	    (inodedep->id_state & ALLCOMPLETE) == ALLCOMPLETE) {
 		dap->da_state &= ~MKDIR_PARENT;
 		WORKITEM_FREE(mkdir2, D_MKDIR);
+		mkdir2 = NULL;
 	} else {
 		LIST_INSERT_HEAD(&mkdirlisthd, mkdir2, md_mkdirs);
 		WORKLIST_INSERT(&inodedep->id_bufwait, &mkdir2->md_list);



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