plug a few coverity-spotted leaks

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jim Meyering
2011-06-20 09:40:06 +02:00
committed by Junio C Hamano
parent 28eb1afec9
commit dc4cd76710
4 changed files with 12 additions and 5 deletions

View File

@ -811,19 +811,21 @@ static void parse_push(struct strbuf *buf)
strbuf_reset(buf);
if (strbuf_getline(buf, stdin, '\n') == EOF)
return;
goto free_specs;
if (!*buf->buf)
break;
} while (1);
if (push(nr_spec, specs))
exit(128); /* error already reported */
for (i = 0; i < nr_spec; i++)
free(specs[i]);
free(specs);
printf("\n");
fflush(stdout);
free_specs:
for (i = 0; i < nr_spec; i++)
free(specs[i]);
free(specs);
}
int main(int argc, const char **argv)