diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2014-04-21 18:23:21 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2014-04-21 18:23:21 -0300 |
commit | 99bc23771f71d0a1460ff41c2e30f5d4a41963d9 (patch) | |
tree | 5d788cb93c744d664043947a10e2aa5325ba8c43 /ProcessList.c | |
parent | af027497225d11cb14e2471165750aafbbc31683 (diff) |
Fix resource leak detected by cppcheck
Diffstat (limited to 'ProcessList.c')
-rw-r--r-- | ProcessList.c | 13 |
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); } |