1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-23 13:46:09 +02:00

Merge branch 'jk/strbuf-detach-always-non-null'

* jk/strbuf-detach-always-non-null:
  strbuf: always return a non-NULL value from strbuf_detach
This commit is contained in:
Jeff King 2012-10-25 06:43:03 -04:00
commit 2cfceefaca

View File

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