Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Feb 2014 21:50:46 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r262577 - head/cddl/contrib/opensolaris/lib/libzfs/common
Message-ID:  <201402272150.s1RLokGO095148@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Thu Feb 27 21:50:46 2014
New Revision: 262577
URL: http://svnweb.freebsd.org/changeset/base/262577

Log:
  MFV r262570:
  
  4626 libzfs memleak in zpool_in_use()
  
  illumos/illumos-gate@fb13f48f1d9593453b94cd1c7277553b56f493c8
  
  MFC after:	2 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.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_import.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c	Thu Feb 27 21:49:47 2014	(r262576)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c	Thu Feb 27 21:50:46 2014	(r262577)
@@ -20,8 +20,8 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
  */
 
 /*
@@ -1613,9 +1613,16 @@ zpool_in_use(libzfs_handle_t *hdl, int f
 		 * its state to active.
 		 */
 		if (pool_active(hdl, name, guid, &isactive) == 0 && isactive &&
-		    (zhp = zpool_open_canfail(hdl, name)) != NULL &&
-		    zpool_get_prop_int(zhp, ZPOOL_PROP_READONLY, NULL))
-			stateval = POOL_STATE_ACTIVE;
+		    (zhp = zpool_open_canfail(hdl, name)) != NULL) {
+			if (zpool_get_prop_int(zhp, ZPOOL_PROP_READONLY, NULL))
+				stateval = POOL_STATE_ACTIVE;
+
+			/*
+			 * All we needed the zpool handle for is the
+			 * readonly prop check.
+			 */
+			zpool_close(zhp);
+		}
 
 		ret = B_TRUE;
 		break;



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