diff --git a/include/sigar_private.h b/include/sigar_private.h index 64841262..d41d9eda 100644 --- a/include/sigar_private.h +++ b/include/sigar_private.h @@ -70,6 +70,7 @@ char *ifconf_buf; \ int ifconf_len; \ char *self_path; \ + sigar_cache_t *fsdev; \ sigar_cache_t *proc_cpu; \ sigar_cache_t *net_listen; \ sigar_cache_t *net_services_tcp; \ diff --git a/src/os/hpux/hpux_sigar.c b/src/os/hpux/hpux_sigar.c index 9d500366..6c89afd2 100644 --- a/src/os/hpux/hpux_sigar.c +++ b/src/os/hpux/hpux_sigar.c @@ -49,8 +49,6 @@ int sigar_os_open(sigar_t **sigar) (*sigar)->pinfo = NULL; - (*sigar)->fsdev = NULL; - (*sigar)->mib = -1; return SIGAR_OK; @@ -62,9 +60,6 @@ int sigar_os_close(sigar_t *sigar) if (sigar->pinfo) { free(sigar->pinfo); } - if (sigar->fsdev) { - sigar_cache_destroy(sigar->fsdev); - } if (sigar->mib >= 0) { close_mib(sigar->mib); } diff --git a/src/os/hpux/sigar_os.h b/src/os/hpux/sigar_os.h index 6b0534ab..2e6339af 100644 --- a/src/os/hpux/sigar_os.h +++ b/src/os/hpux/sigar_os.h @@ -43,7 +43,6 @@ struct sigar_t { sigar_pid_t last_pid; struct pst_status *pinfo; - sigar_cache_t *fsdev; int mib; }; diff --git a/src/os/linux/linux_sigar.c b/src/os/linux/linux_sigar.c index f6ed4fa6..2aefe976 100644 --- a/src/os/linux/linux_sigar.c +++ b/src/os/linux/linux_sigar.c @@ -168,8 +168,6 @@ int sigar_os_open(sigar_t **sigar) (*sigar)->iostat = IOSTAT_NONE; } - (*sigar)->fsdev = NULL; - /* hook for using mirrored /proc/net/tcp file */ (*sigar)->proc_net = getenv("SIGAR_PROC_NET"); @@ -178,9 +176,6 @@ int sigar_os_open(sigar_t **sigar) int sigar_os_close(sigar_t *sigar) { - if (sigar->fsdev) { - sigar_cache_destroy(sigar->fsdev); - } free(sigar); return SIGAR_OK; } diff --git a/src/os/linux/sigar_os.h b/src/os/linux/sigar_os.h index 031f78e4..4e8e5998 100644 --- a/src/os/linux/sigar_os.h +++ b/src/os/linux/sigar_os.h @@ -67,7 +67,6 @@ struct sigar_t { int ht_enabled; int lcpu; linux_iostat_e iostat; - sigar_cache_t *fsdev; char *proc_net; }; diff --git a/src/os/solaris/sigar_os.h b/src/os/solaris/sigar_os.h index 92a1c259..fdaa411e 100644 --- a/src/os/solaris/sigar_os.h +++ b/src/os/solaris/sigar_os.h @@ -255,7 +255,6 @@ struct sigar_t { proc_dirname_func_t pdirname; proc_exename_func_t pexename; - sigar_cache_t *fsdev; sigar_cache_t *pargs; solaris_mib2_t mib2; diff --git a/src/os/solaris/solaris_sigar.c b/src/os/solaris/solaris_sigar.c index cd54c6e6..f937895b 100644 --- a/src/os/solaris/solaris_sigar.c +++ b/src/os/solaris/solaris_sigar.c @@ -115,7 +115,6 @@ int sigar_os_open(sigar_t **sig) sigar->pfree = NULL; sigar->pobjname = NULL; - sigar->fsdev = NULL; sigar->pargs = NULL; SIGAR_ZERO(&sigar->mib2); @@ -144,9 +143,6 @@ int sigar_os_close(sigar_t *sigar) if (sigar->plib) { dlclose(sigar->plib); } - if (sigar->fsdev) { - sigar_cache_destroy(sigar->fsdev); - } if (sigar->pargs) { sigar_cache_destroy(sigar->pargs); } diff --git a/src/sigar.c b/src/sigar.c index 82fa63b1..c2777a15 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -48,6 +48,7 @@ SIGAR_DECLARE(int) sigar_open(sigar_t **sigar) (*sigar)->ptql_re_impl = NULL; (*sigar)->ptql_re_data = NULL; (*sigar)->self_path = NULL; + (*sigar)->fsdev = NULL; (*sigar)->proc_cpu = NULL; (*sigar)->net_listen = NULL; (*sigar)->net_services_tcp = NULL; @@ -65,6 +66,9 @@ SIGAR_DECLARE(int) sigar_close(sigar_t *sigar) if (sigar->self_path) { free(sigar->self_path); } + if (sigar->fsdev) { + sigar_cache_destroy(sigar->fsdev); + } if (sigar->proc_cpu) { sigar_cache_destroy(sigar->proc_cpu); }