summaryrefslogtreecommitdiffstats
path: root/cddl
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-02-27 21:50:46 +0000
committerdelphij <delphij@FreeBSD.org>2014-02-27 21:50:46 +0000
commit8d9721842c201047cd103ce9e401ad81b3d7b75b (patch)
tree44687706f4c3c6cf090e5c6bee0f8be9c58af526 /cddl
parent42ee1c87f6d1fc69843c4db568468c7c22072d2d (diff)
downloadFreeBSD-src-8d9721842c201047cd103ce9e401ad81b3d7b75b.zip
FreeBSD-src-8d9721842c201047cd103ce9e401ad81b3d7b75b.tar.gz
MFV r262570:
4626 libzfs memleak in zpool_in_use() illumos/illumos-gate@fb13f48f1d9593453b94cd1c7277553b56f493c8 MFC after: 2 weeks
Diffstat (limited to 'cddl')
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
index f683adb..e53a8cd 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
@@ -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 fd, pool_state_t *state, char **namestr,
* 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;
OpenPOWER on IntegriCloud