diff options
author | gjelinek <none@none> | 2007-02-26 13:20:51 -0800 |
---|---|---|
committer | gjelinek <none@none> | 2007-02-26 13:20:51 -0800 |
commit | e767a340776ab621d2b82ee83e1755c45fa979c8 (patch) | |
tree | 861ec18ecc9986e4692a552f01d855e1b0dd98d0 | |
parent | b071742beee33760f5b3bd8889b958469462a079 (diff) | |
download | illumos-joyent-e767a340776ab621d2b82ee83e1755c45fa979c8.tar.gz |
6527301 zoneadmd has sprung a few leaks
-rw-r--r-- | usr/src/cmd/zoneadm/zoneadm.c | 2 | ||||
-rw-r--r-- | usr/src/cmd/zoneadmd/vplat.c | 12 | ||||
-rw-r--r-- | usr/src/cmd/zoneadmd/zoneadmd.c | 3 | ||||
-rw-r--r-- | usr/src/lib/libzonecfg/common/libzonecfg.c | 4 |
4 files changed, 17 insertions, 4 deletions
diff --git a/usr/src/cmd/zoneadm/zoneadm.c b/usr/src/cmd/zoneadm/zoneadm.c index b1384d80c9..c7a6dab1ed 100644 --- a/usr/src/cmd/zoneadm/zoneadm.c +++ b/usr/src/cmd/zoneadm/zoneadm.c @@ -3040,6 +3040,7 @@ verify_details(int cmd_num, char *argv[]) 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 @@ verify_details(int cmd_num, char *argv[]) "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) { diff --git a/usr/src/cmd/zoneadmd/vplat.c b/usr/src/cmd/zoneadmd/vplat.c index a527605ff7..d20821e542 100644 --- a/usr/src/cmd/zoneadmd/vplat.c +++ b/usr/src/cmd/zoneadmd/vplat.c @@ -1091,7 +1091,7 @@ mount_one_dev(zlog_t *zlogp, char *devpath) 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 @@ mount_filesystems(zlog_t *zlogp, boolean_t mount_cmd) 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 @@ mount_filesystems(zlog_t *zlogp, boolean_t mount_cmd) 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 @@ get_privset(zlog_t *zlogp, priv_set_t *privs, boolean_t mount_cmd) 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 @@ vplat_create(zlog_t *zlogp, boolean_t mount_cmd) * 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 @@ vplat_teardown(zlog_t *zlogp, boolean_t unmount_cmd, boolean_t rebooting) 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) { diff --git a/usr/src/cmd/zoneadmd/zoneadmd.c b/usr/src/cmd/zoneadmd/zoneadmd.c index 35206384b9..32ce2137d6 100644 --- a/usr/src/cmd/zoneadmd/zoneadmd.c +++ b/usr/src/cmd/zoneadmd/zoneadmd.c @@ -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 @@ zone_bootup(zlog_t *zlogp, const char *bootargs) */ 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); diff --git a/usr/src/lib/libzonecfg/common/libzonecfg.c b/usr/src/lib/libzonecfg/common/libzonecfg.c index adc270c9b9..f2c5570861 100644 --- a/usr/src/lib/libzonecfg/common/libzonecfg.c +++ b/usr/src/lib/libzonecfg/common/libzonecfg.c @@ -4980,8 +4980,10 @@ zone_get_zonepath(char *zone_name, char *zonepath, size_t rp_sz) * 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); |