diff options
author | Jan-Erik Rediger <janerik@fnordig.de> | 2016-12-09 10:51:10 +0100 |
---|---|---|
committer | Jan-Erik Rediger <janerik@fnordig.de> | 2016-12-09 10:51:26 +0100 |
commit | 8636d90821f9656c62e92e78d93a380fc00fc0f7 (patch) | |
tree | 9dc90df476fe7ef9cd75892c53d61f3decfcdec4 | |
parent | afdef3e6ecc790dd2f256a944e397018112e0403 (diff) |
Avoid unchecked malloc
Closes #471
-rw-r--r-- | sds.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -89,9 +89,9 @@ sds sdsnewlen(const void *init, size_t initlen) { unsigned char *fp; /* flags pointer. */ sh = s_malloc(hdrlen+initlen+1); + if (sh == NULL) return NULL; if (!init) memset(sh, 0, hdrlen+initlen+1); - if (sh == NULL) return NULL; s = (char*)sh+hdrlen; fp = ((unsigned char*)s)-1; switch(type) { |