Illumos 4626 - libzfs memleak in zpool_in_use()
4626 libzfs memleak in zpool_in_use() Reviewed by: Tony Nguyen <tony.nguyen@nexenta.com> Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com> Reviewed by: George Wilson <george.wilson@delphix.com> Approved by: Dan McDonald <danmcd@omniti.com> References: https://github.com/illumos/illumos-gate/commit/fb13f48 https://www.illumos.org/issues/4626 Ported-by: kernelOfTruth kerneloftruth@gmail.com Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3563
This commit is contained in:
parent
cc49250563
commit
02f8fe4260
|
@ -20,8 +20,8 @@
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* 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 (c) 2012 by Delphix. All rights reserved.
|
||||||
|
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1532,10 +1532,17 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
|
||||||
* its state to active.
|
* its state to active.
|
||||||
*/
|
*/
|
||||||
if (pool_active(hdl, name, guid, &isactive) == 0 && isactive &&
|
if (pool_active(hdl, name, guid, &isactive) == 0 && isactive &&
|
||||||
(zhp = zpool_open_canfail(hdl, name)) != NULL &&
|
(zhp = zpool_open_canfail(hdl, name)) != NULL) {
|
||||||
zpool_get_prop_int(zhp, ZPOOL_PROP_READONLY, NULL))
|
if (zpool_get_prop_int(zhp, ZPOOL_PROP_READONLY, NULL))
|
||||||
stateval = POOL_STATE_ACTIVE;
|
stateval = POOL_STATE_ACTIVE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All we needed the zpool handle for is the
|
||||||
|
* readonly prop check.
|
||||||
|
*/
|
||||||
|
zpool_close(zhp);
|
||||||
|
}
|
||||||
|
|
||||||
ret = B_TRUE;
|
ret = B_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue