--- projects/libstatgrab/src/libstatgrab/os_info.c 2005/09/24 13:29:22 1.23 +++ projects/libstatgrab/src/libstatgrab/os_info.c 2006/10/09 14:09:38 1.24 @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA * - * $Id: os_info.c,v 1.23 2005/09/24 13:29:22 tdb Exp $ + * $Id: os_info.c,v 1.24 2006/10/09 14:09:38 tdb Exp $ */ #ifdef HAVE_CONFIG_H @@ -324,14 +324,17 @@ sg_host_info *sg_get_host_info() } if((ksp=kstat_lookup(kc, "unix", -1, "system_misc"))==NULL){ sg_set_error(SG_ERROR_KSTAT_LOOKUP, "unix,-1,system_misc"); + kstat_close(kc); return NULL; } if (kstat_read(kc, ksp, 0) == -1) { sg_set_error(SG_ERROR_KSTAT_READ, NULL); + kstat_close(kc); return NULL; } if((kn=kstat_data_lookup(ksp, "boot_time")) == NULL){ sg_set_error(SG_ERROR_KSTAT_DATA_LOOKUP, "boot_time"); + kstat_close(kc); return NULL; } boottime=(kn->value.ui32);