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:
Sami Kerola 2019-05-16 21:56:57 +01:00
parent 30d5ceeda8
commit d2a1ee4e56
No known key found for this signature in database
GPG key ID: 0D46FEF7E61DBB46

View file

@ -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;
} }