Fix resource leak detected by cppcheck

This commit is contained in:
Hisham Muhammad 2014-04-21 18:23:21 -03:00
parent af02749722
commit 99bc23771f
1 changed files with 6 additions and 7 deletions

View File

@ -669,14 +669,13 @@ static void ProcessList_readOomData(Process* process, const char* dirname, const
if (!file) if (!file)
return; return;
char buffer[256]; char buffer[256];
if (!fgets(buffer, 255, file)) { if (fgets(buffer, 255, file)) {
return;
}
unsigned int oom; unsigned int oom;
int ok = sscanf(buffer, "%u", &oom); int ok = sscanf(buffer, "%u", &oom);
if (ok >= 1) { if (ok >= 1) {
process->oom = oom; process->oom = oom;
} }
}
fclose(file); fclose(file);
} }