Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Nov 2013 20:45:31 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r258594 - head/lib/libnv
Message-ID:  <201311252045.rAPKjVPY028905@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Mon Nov 25 20:45:30 2013
New Revision: 258594
URL: http://svnweb.freebsd.org/changeset/base/258594

Log:
  Fix double free().
  
  Reported by:	Coverity
  Coverity CID:	1130048

Modified:
  head/lib/libnv/nvpair.c

Modified: head/lib/libnv/nvpair.c
==============================================================================
--- head/lib/libnv/nvpair.c	Mon Nov 25 20:39:09 2013	(r258593)
+++ head/lib/libnv/nvpair.c	Mon Nov 25 20:45:30 2013	(r258594)
@@ -683,10 +683,8 @@ nvpair_unpack(int flags, const unsigned 
 	if (ptr == NULL)
 		goto failed;
 	tmp = realloc(nvp, sizeof(*nvp) + strlen(nvp->nvp_name) + 1);
-	if (tmp == NULL) {
-		free(nvp);
+	if (tmp == NULL)
 		goto failed;
-	}
 	nvp = tmp;
 	/* Update nvp_name after realloc(). */
 	nvp->nvp_name = (char *)(nvp + 1);



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