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)
return;
char buffer[256];
if (!fgets(buffer, 255, file)) {
return;
}
if (fgets(buffer, 255, file)) {
unsigned int oom;
int ok = sscanf(buffer, "%u", &oom);
if (ok >= 1) {
process->oom = oom;
}
}
fclose(file);
}