提交 53970b92 编写于 作者: T Tay Ray Chuan 提交者: Junio C Hamano

builtin-push: don't access freed transport->url

Move the failed push message to before transport_disconnect() so that
it doesn't access transport->url after transport has been free()'d (in
transport_disconnect()).

Additionally, make the failed push message more accurate by moving it
before transport_disconnect(), so that it doesn't report errors due
to a failed disconnect.
Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
Acked-by: NDaniel Barkalow <barkalow@iabervon.org>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 2fe40b63
......@@ -102,13 +102,14 @@ static int push_with_options(struct transport *transport, int flags)
fprintf(stderr, "Pushing to %s\n", transport->url);
err = transport_push(transport, refspec_nr, refspec, flags,
&nonfastforward);
if (err != 0)
error("failed to push some refs to '%s'", transport->url);
err |= transport_disconnect(transport);
if (!err)
return 0;
error("failed to push some refs to '%s'", transport->url);
if (nonfastforward && advice_push_nonfastforward) {
printf("To prevent you from losing history, non-fast-forward updates were rejected\n"
"Merge the remote changes before pushing again. See the 'non-fast-forward'\n"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册