Avoid unchecked malloc

Closes #471
This commit is contained in:
Jan-Erik Rediger 2016-12-09 10:51:10 +01:00
parent afdef3e6ec
commit 8636d90821
1 changed files with 1 additions and 1 deletions

2
sds.c
View File

@ -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) {