зеркало из https://github.com/microsoft/git.git
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: Tay Ray Chuan <rctay89@gmail.com> Acked-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
2fe40b6300
Коммит
53970b92d9
|
@ -102,13 +102,14 @@ static int push_with_options(struct transport *transport, int flags)
|
||||||
fprintf(stderr, "Pushing to %s\n", transport->url);
|
fprintf(stderr, "Pushing to %s\n", transport->url);
|
||||||
err = transport_push(transport, refspec_nr, refspec, flags,
|
err = transport_push(transport, refspec_nr, refspec, flags,
|
||||||
&nonfastforward);
|
&nonfastforward);
|
||||||
|
if (err != 0)
|
||||||
|
error("failed to push some refs to '%s'", transport->url);
|
||||||
|
|
||||||
err |= transport_disconnect(transport);
|
err |= transport_disconnect(transport);
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error("failed to push some refs to '%s'", transport->url);
|
|
||||||
|
|
||||||
if (nonfastforward && advice_push_nonfastforward) {
|
if (nonfastforward && advice_push_nonfastforward) {
|
||||||
printf("To prevent you from losing history, non-fast-forward updates were rejected\n"
|
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"
|
"Merge the remote changes before pushing again. See the 'non-fast-forward'\n"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче