1
0
mirror of https://github.com/xzeldon/htop.git synced 2025-04-11 13:07:08 +03:00

parseBatInfo: check line for NULL before passing it to String_getToken()

This commit is contained in:
Jan Chren (rindeal) 2017-05-06 01:25:20 +02:00 committed by Hisham Muhammad
parent b84ebfd4e8
commit b0588d90ff

@ -72,6 +72,8 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
fclose(file); fclose(file);
if (!line) break;
char *foundNumStr = String_getToken(line, wordNum); char *foundNumStr = String_getToken(line, wordNum);
const unsigned long int foundNum = atoi(foundNumStr); const unsigned long int foundNum = atoi(foundNumStr);
free(foundNumStr); free(foundNumStr);