summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2014-04-21 18:23:21 -0300
committerHisham Muhammad <hisham@gobolinux.org>2014-04-21 18:23:21 -0300
commit99bc23771f71d0a1460ff41c2e30f5d4a41963d9 (patch)
tree5d788cb93c744d664043947a10e2aa5325ba8c43
parentaf027497225d11cb14e2471165750aafbbc31683 (diff)
Fix resource leak detected by cppcheck
-rw-r--r--ProcessList.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/ProcessList.c b/ProcessList.c
index b8a2991b..10ea25a1 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -669,13 +669,12 @@ static void ProcessList_readOomData(Process* process, const char* dirname, const
if (!file)
return;
char buffer[256];
- if (!fgets(buffer, 255, file)) {
- return;
- }
- unsigned int oom;
- int ok = sscanf(buffer, "%u", &oom);
- if (ok >= 1) {
- process->oom = oom;
+ if (fgets(buffer, 255, file)) {
+ unsigned int oom;
+ int ok = sscanf(buffer, "%u", &oom);
+ if (ok >= 1) {
+ process->oom = oom;
+ }
}
fclose(file);
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy