library: at unref, close these cached file descriptors

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2022-06-02 00:00:00 -05:00 committed by Craig Small
parent f8f3ea2527
commit 15a6203b00
2 changed files with 6 additions and 0 deletions

View File

@ -859,6 +859,9 @@ PROCPS_EXPORT int procps_meminfo_unref (
if ((*info)->refcount < 1) { if ((*info)->refcount < 1) {
int errno_sav = errno; int errno_sav = errno;
if ((*info)->meminfo_fd != -1)
close((*info)->meminfo_fd);
if ((*info)->extents) if ((*info)->extents)
meminfo_extents_free_all((*info)); meminfo_extents_free_all((*info));
if ((*info)->items) if ((*info)->items)

View File

@ -1356,6 +1356,9 @@ PROCPS_EXPORT int procps_vmstat_unref (
if ((*info)->refcount < 1) { if ((*info)->refcount < 1) {
int errno_sav = errno; int errno_sav = errno;
if ((*info)->vmstat_fd != -1)
close((*info)->vmstat_fd);
if ((*info)->extents) if ((*info)->extents)
vmstat_extents_free_all((*info)); vmstat_extents_free_all((*info));
if ((*info)->items) if ((*info)->items)