--- projects/libstatgrab/src/libstatgrab/network_stats.c 2006/01/22 18:10:39 1.77 +++ projects/libstatgrab/src/libstatgrab/network_stats.c 2006/10/09 14:09:38 1.78 @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA * - * $Id: network_stats.c,v 1.77 2006/01/22 18:10:39 tdb Exp $ + * $Id: network_stats.c,v 1.78 2006/10/09 14:09:38 tdb Exp $ */ #ifdef HAVE_CONFIG_H @@ -230,6 +230,7 @@ sg_network_io_stats *sg_get_network_io_stats(int *entr /* Create new network_stats */ if (VECTOR_RESIZE(network_stats, interfaces + 1) < 0) { + kstat_close(kc); return NULL; } network_stat_ptr=network_stats+interfaces; @@ -276,6 +277,7 @@ sg_network_io_stats *sg_get_network_io_stats(int *entr /* Read interface name */ if (sg_update_string(&network_stat_ptr->interface_name, ksp->ks_name) < 0) { + kstat_close(kc); return NULL; } @@ -665,6 +667,7 @@ sg_network_iface_stats *sg_get_network_iface_stats(int if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0) { sg_set_error_with_errno(SG_ERROR_SOCKET, NULL); + kstat_close(kc); return NULL; } @@ -681,6 +684,7 @@ sg_network_iface_stats *sg_get_network_iface_stats(int } if (VECTOR_RESIZE(network_iface_stats, ifaces + 1) < 0) { + kstat_close(kc); return NULL; } network_iface_stat_ptr = network_iface_stats + ifaces; @@ -688,6 +692,7 @@ sg_network_iface_stats *sg_get_network_iface_stats(int if (sg_update_string(&network_iface_stat_ptr->interface_name, ksp->ks_name) < 0) { + kstat_close(kc); return NULL; }