From: Daniel Barkalow <barkalow@iabervon.org>
To: Tay Ray Chuan <rctay89@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Sverre Rabbelier <srabbelier@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] builtin-push: don't access freed transport->url
Date: Thu, 3 Dec 2009 18:38:13 -0500 (EST) [thread overview]
Message-ID: <alpine.LNX.2.00.0912031837570.14365@iabervon.org> (raw)
In-Reply-To: <20091204073144.f98115f9.rctay89@gmail.com>
On Fri, 4 Dec 2009, Tay Ray Chuan wrote:
> 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.
>
> Cc: "Daniel Barkalow" <barkalow@iabervon.org>
> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
> ---
> builtin-push.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/builtin-push.c b/builtin-push.c
> index a21e46c..dcfb53f 100644
> --- a/builtin-push.c
> +++ b/builtin-push.c
> @@ -101,13 +101,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"
> --
> 1.6.6.rc1.249.g048b3
>
next prev parent reply other threads:[~2009-12-03 23:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-03 23:31 [PATCH] builtin-push: don't access freed transport->url Tay Ray Chuan
2009-12-03 23:38 ` Daniel Barkalow [this message]
2009-12-04 0:31 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.00.0912031837570.14365@iabervon.org \
--to=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rctay89@gmail.com \
--cc=srabbelier@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox