diff options
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c index cdf8ca0..7c2b86b 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -215,11 +215,12 @@ unsigned char *strbuf_detach(strbuf *buf) { unsigned char *data = buf->ptr; - if (buf->asize == 0 || buf->ptr == strbuf__oom) - return NULL; + if (buf->asize == 0 || buf->ptr == strbuf__oom) { + /* return an empty string */ + return calloc(1, 1); + } strbuf_init(buf, 0); - return data; } |