diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-10-24 19:15:59 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-10-24 19:15:59 -0700 |
commit | 2315882a431844394a2ec5300c03debf18713cb8 (patch) | |
tree | c71ea56cd678dbc8d2c50bc30d814015777d9367 /src/chunk.h | |
parent | 511e92f39fe9bdca51bea3ee0add95a6eca880f5 (diff) | |
parent | 0350e2dd936fbca4a911f096462e26af83469b81 (diff) |
Merge branch 'master' of https://github.com/tchetch/stmd into tchetch-master
Conflicts:
src/inlines.c
Diffstat (limited to 'src/chunk.h')
-rw-r--r-- | src/chunk.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/chunk.h b/src/chunk.h index f37a2f3..015bbf9 100644 --- a/src/chunk.h +++ b/src/chunk.h @@ -59,10 +59,11 @@ static inline unsigned char *chunk_to_cstr(chunk *c) { unsigned char *str; - str = malloc(c->len + 1); - memcpy(str, c->data, c->len); - str[c->len] = 0; - + str = calloc(c->len + 1, sizeof(*str)); + if(str != NULL) { + memcpy(str, c->data, c->len); + str[c->len] = 0; + } return str; } |