Mercurial > illumos > illumos-gate
changeset 3716:1429cb51c952
6527301 zoneadmd has sprung a few leaks
author | gjelinek |
---|---|
date | Mon, 26 Feb 2007 13:20:51 -0800 |
parents | ffe268e01dfa |
children | 8471164f3e47 |
files | usr/src/cmd/zoneadm/zoneadm.c usr/src/cmd/zoneadmd/vplat.c usr/src/cmd/zoneadmd/zoneadmd.c usr/src/lib/libzonecfg/common/libzonecfg.c |
diffstat | 4 files changed, 17 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/zoneadm/zoneadm.c Mon Feb 26 09:52:03 2007 -0800 +++ b/usr/src/cmd/zoneadm/zoneadm.c Mon Feb 26 13:20:51 2007 -0800 @@ -3040,6 +3040,7 @@ sizeof (checkpath))) != Z_OK) { errno = err; zperror2(target_zone, gettext("could not get zone path")); + zonecfg_fini_handle(handle); return (Z_ERR); } if (strcmp(zonepath, checkpath) != 0) { @@ -3051,6 +3052,7 @@ "zonepath '%s',\nbut the index file has zonepath '%s'.\n" "These must match, so fix the incorrect entry.\n"), zonepath, checkpath); + zonecfg_fini_handle(handle); return (Z_ERR); } if (validate_zonepath(zonepath, cmd_num) != Z_OK) {
--- a/usr/src/cmd/zoneadmd/vplat.c Mon Feb 26 09:52:03 2007 -0800 +++ b/usr/src/cmd/zoneadmd/vplat.c Mon Feb 26 13:20:51 2007 -0800 @@ -1091,7 +1091,7 @@ cleanup: if (bh != NULL) brand_close(bh); - if (handle) + if (handle != NULL) zonecfg_fini_handle(handle); if (prof) di_prof_fini(prof); @@ -1640,6 +1640,7 @@ if ((zone_get_brand(zone_name, brand, sizeof (brand)) != Z_OK) || (bh = brand_open(brand)) == NULL) { zerror(zlogp, B_FALSE, "unable to determine zone brand"); + zonecfg_fini_handle(handle); return (-1); } @@ -1654,6 +1655,7 @@ plat_gmount_cb, &cb) != 0) { zerror(zlogp, B_FALSE, "unable to mount filesystems"); brand_close(bh); + zonecfg_fini_handle(handle); return (-1); } brand_close(bh); @@ -2846,8 +2848,10 @@ break; } - if (zonecfg_default_privset(privs, curr_iptype) == Z_OK) + if (zonecfg_default_privset(privs, curr_iptype) == Z_OK) { + zonecfg_fini_handle(handle); return (0); + } zerror(zlogp, B_FALSE, "failed to determine the zone's default privilege set"); zonecfg_fini_handle(handle); @@ -4095,10 +4099,12 @@ * get it loaded and initialized. */ if (brand_get_modname(bh, modname, MAXPATHLEN) < 0) { + brand_close(bh); zerror(zlogp, B_FALSE, "unable to determine brand kernel " "module"); return (-1); } + brand_close(bh); if (strlen(modname) > 0) { (void) strlcpy(attr.ba_modname, modname, MAXPATHLEN); @@ -4495,6 +4501,8 @@ zonecfg_get_handle(zone_name, handle) == Z_OK && zonecfg_lookup_pset(handle, &pset_tab) == Z_OK) destroy_tmp_pool = B_FALSE; + + zonecfg_fini_handle(handle); } if (destroy_tmp_pool) {
--- a/usr/src/cmd/zoneadmd/zoneadmd.c Mon Feb 26 09:52:03 2007 -0800 +++ b/usr/src/cmd/zoneadmd/zoneadmd.c Mon Feb 26 13:20:51 2007 -0800 @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -660,6 +660,7 @@ */ if (zone_get_zonepath(zone_name, zroot, sizeof (zroot)) != Z_OK) { zerror(zlogp, B_FALSE, "unable to determine zone root"); + brand_close(bh); return (-1); } (void) strcpy(cmdbuf, EXEC_PREFIX);
--- a/usr/src/lib/libzonecfg/common/libzonecfg.c Mon Feb 26 09:52:03 2007 -0800 +++ b/usr/src/lib/libzonecfg/common/libzonecfg.c Mon Feb 26 13:20:51 2007 -0800 @@ -4980,8 +4980,10 @@ * may have changed. */ if (zonecfg_get_snapshot_handle(zone_name, handle) != Z_OK) { - if ((err = zonecfg_get_handle(zone_name, handle)) != Z_OK) + if ((err = zonecfg_get_handle(zone_name, handle)) != Z_OK) { + zonecfg_fini_handle(handle); return (err); + } } err = zonecfg_get_zonepath(handle, zonepath, rp_sz); zonecfg_fini_handle(handle);