diff options
author | Jeff King <peff@peff.net> | 2012-10-25 14:43:03 +0400 |
---|---|---|
committer | Jeff King <peff@peff.net> | 2012-10-25 14:43:03 +0400 |
commit | 2cfceefaca16d64baecf0ba9bcd4e05229d9c31b (patch) | |
tree | 69a2c86a062be469fab032cfdb017134343a6147 | |
parent | bbbd0573895f7f79aeb1faa5c0333915947096c0 (diff) | |
parent | 08ad56f3f0c1df8f75bac84bcef0d9d0c9b4d20f (diff) |
Merge branch 'jk/strbuf-detach-always-non-null'
* jk/strbuf-detach-always-non-null:
strbuf: always return a non-NULL value from strbuf_detach
-rw-r--r-- | strbuf.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -44,7 +44,9 @@ void strbuf_release(struct strbuf *sb) char *strbuf_detach(struct strbuf *sb, size_t *sz) { - char *res = sb->alloc ? sb->buf : NULL; + char *res; + strbuf_grow(sb, 0); + res = sb->buf; if (sz) *sz = sb->len; strbuf_init(sb, 0); |