plug possible fd leak if pgrab fails for proc_modules

This commit is contained in:
Doug MacEachern 2005-07-13 15:58:07 +00:00
parent 5b5f4bf48f
commit cc4f93cf8f
1 changed files with 2 additions and 0 deletions

View File

@ -975,12 +975,14 @@ static int sigar_pgrab_modules(sigar_t *sigar, sigar_pid_t pid,
} }
if ((pstatus = sigar_init_libproc(sigar)) != SIGAR_OK) { if ((pstatus = sigar_init_libproc(sigar)) != SIGAR_OK) {
close(fd);
return pstatus; return pstatus;
} }
pstatus = sigar_pgrab(sigar, pid, SIGAR_FUNC, &phandle); pstatus = sigar_pgrab(sigar, pid, SIGAR_FUNC, &phandle);
if (pstatus != SIGAR_OK) { if (pstatus != SIGAR_OK) {
close(fd);
return pstatus; return pstatus;
} }