fast-import.c: fix regression due to strbuf conversion
authorPierre Habouzit <madcoder@debian.org>
Fri, 26 Oct 2007 07:59:12 +0000 (09:59 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 26 Oct 2007 22:28:09 +0000 (15:28 -0700)
Without this strbuf_detach(), it yields a double free later, the
command is in fact stashed, and this is not a memory leak.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fast-import.c

index 6f888f64767ee78ef198180c6e628ddb60e09191..f93d7d6c9bf2db021ceb65766da87af32aecc1d1 100644 (file)
@@ -1616,6 +1616,7 @@ static void cmd_data(struct strbuf *sb)
                char *term = xstrdup(command_buf.buf + 5 + 2);
                size_t term_len = command_buf.len - 5 - 2;
 
+               strbuf_detach(&command_buf, NULL);
                for (;;) {
                        if (strbuf_getline(&command_buf, stdin, '\n') == EOF)
                                die("EOF in data (terminator '%s' not found)", term);