index 4a8c73bfaee14c84866f1a20b7fcd8421d3812f1..cfadc6a292033d349f6b1efff75d2c4f9f2525fe 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -119,9 +119,10 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
*/
strbuf_init(&buf, 0);
if (convert_to_working_tree(ce->name, new, size, &buf)) {
+ size_t newsize = 0;
free(new);
- new = buf.buf;
- size = buf.len;
+ new = strbuf_detach(&buf, &newsize);
+ size = newsize;
}
if (to_tempfile) {