Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
b0588d90
Commit
b0588d90
authored
May 06, 2017
by
Jan Chren (rindeal)
Committed by
Hisham Muhammad
Feb 04, 2018
Browse files
parseBatInfo: check `line` for NULL before passing it to String_getToken()
parent
b84ebfd4
Changes
1
Hide whitespace changes
Inline
Side-by-side
linux/Battery.c
View file @
b0588d90
...
@@ -72,6 +72,8 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment