include/strutils: fix potential null pointer dereference
Recent lscpu fix caused gcc -Wnull-dereference to go off that this change
addresses.
Reference: b94acada9e
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
30d5ceeda8
commit
d2a1ee4e56
1 changed files with 3 additions and 1 deletions
|
@ -258,7 +258,9 @@ static inline void strrem(char *s, int rem)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
for (p = s; s && *s; s++) {
|
if (!s)
|
||||||
|
return;
|
||||||
|
for (p = s; *s; s++) {
|
||||||
if (*s != rem)
|
if (*s != rem)
|
||||||
*p++ = *s;
|
*p++ = *s;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue