diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-03-27 16:46:57 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-03-27 16:46:57 -0400 |
commit | 2433d04fb3d3204cdc041ed7d9e2509ce2684ea7 (patch) | |
tree | 61ee5c04c51b687a386b93fe641a288a8f793fbd | |
parent | 85e3866192ae8436620ec27e5f659e4da0761e5d (diff) | |
download | spmc-2433d04fb3d3204cdc041ed7d9e2509ce2684ea7.tar.gz |
Return NULL if input is NULL
-rw-r--r-- | lib/str.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -705,6 +705,11 @@ char *normalize_space(char *s) { int add_whitespace = 0; char *result = s; char *tmp; + + if (s == NULL) { + return NULL; + } + if ((tmp = calloc(strlen(s) + 1, sizeof(char))) == NULL) { perror("could not allocate memory for temporary string"); return NULL; |