diff options
author | Vicent Marti <tanoku@gmail.com> | 2014-09-10 19:50:29 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2014-09-10 19:58:22 +0200 |
commit | 8c028e1a88c2d2aac4a4086202568bee43678aa8 (patch) | |
tree | 78fc80b00a62a259419b59d54c3b34e8dcdf334b /src/buffer.c | |
parent | 7c2a062cdf9c0514cdf32f4f8bd07cf52d183c8b (diff) |
Do not create references with empty names
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; } |