svn commit: r275812 - head/cddl/contrib/opensolaris/lib/libzfs/common

Xin LI delphij at FreeBSD.org
Mon Dec 15 18:28:23 UTC 2014


Author: delphij
Date: Mon Dec 15 18:28:22 2014
New Revision: 275812
URL: https://svnweb.freebsd.org/changeset/base/275812

Log:
  MFV r275784:
  
  Plug a memory leak in libzfs.  In zfs_iter_bookmarks, an nvlist is allocated
  before calling lzc_get_bookmarks, which allocates the nvlist again (and
  overwrites the pointer to previously allocated list).
  
  Illumos issue:
      5427 memory leak in libzfs when doing rollback
  
  MFC after:	2 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c	Mon Dec 15 18:22:45 2014	(r275811)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c	Mon Dec 15 18:28:22 2014	(r275812)
@@ -24,7 +24,7 @@
  * Copyright (c) 2013 by Delphix. All rights reserved.
  * Copyright (c) 2012 Pawel Jakub Dawidek <pawel at dawidek.net>.
  * All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include <stdio.h>
@@ -193,9 +193,6 @@ zfs_iter_bookmarks(zfs_handle_t *zhp, zf
 	fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATETXG));
 	fnvlist_add_boolean(props, zfs_prop_to_name(ZFS_PROP_CREATION));
 
-	/* Allocate an nvlist to hold the bookmarks. */
-	bmarks = fnvlist_alloc();
-
 	if ((err = lzc_get_bookmarks(zhp->zfs_name, props, &bmarks)) != 0)
 		goto out;
 


More information about the svn-src-all mailing list