Skip to content

Commit

Permalink
fast-import.c: fix regression due to strbuf conversion
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pierre Habouzit authored and Junio C Hamano committed Oct 26, 2007
1 parent d90a7fd commit c2e6b6d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c2e6b6d

Please sign in to comment.