mirror of https://github.com/xzeldon/htop.git
free(NULL) is a valid no-op, so let's make String_freeArray(NULL) valid too.
This commit is contained in:
parent
bd5d37f297
commit
cceab15b9d
|
@ -93,6 +93,9 @@ char** String_split(const char* s, char sep, int* n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void String_freeArray(char** s) {
|
void String_freeArray(char** s) {
|
||||||
|
if (!s) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (int i = 0; s[i] != NULL; i++) {
|
for (int i = 0; s[i] != NULL; i++) {
|
||||||
free(s[i]);
|
free(s[i]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue