* [PATCH] fetch: do not leak a refspec
@ 2011-06-08 20:06 Jim Meyering
2011-06-09 0:20 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Jim Meyering @ 2011-06-08 20:06 UTC (permalink / raw)
To: git list
Signed-off-by: Jim Meyering <meyering@redhat.com>
---
Coverity spotted this.
builtin/fetch.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index f9c41da..93c9938 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -875,6 +875,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
{
int i;
static const char **refs = NULL;
+ struct refspec *refspec;
int ref_nr = 0;
int exit_code;
@@ -915,8 +916,9 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
sigchain_push_common(unlock_pack_on_signal);
atexit(unlock_pack);
- exit_code = do_fetch(transport,
- parse_fetch_refspec(ref_nr, refs), ref_nr);
+ refspec = parse_fetch_refspec(ref_nr, refs);
+ exit_code = do_fetch(transport, refspec, ref_nr);
+ free(refspec);
transport_disconnect(transport);
transport = NULL;
return exit_code;
--
1.7.6.rc0.293.g40857
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fetch: do not leak a refspec
2011-06-08 20:06 [PATCH] fetch: do not leak a refspec Jim Meyering
@ 2011-06-09 0:20 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2011-06-09 0:20 UTC (permalink / raw)
To: Jim Meyering; +Cc: git list
Jim Meyering <jim@meyering.net> writes:
> Signed-off-by: Jim Meyering <meyering@redhat.com>
> ---
> Coverity spotted this.
Thanks, will apply, but it seems that Coverity does not know or care that
this codepath is used only once in the process and the process immediately
exits after the small leak that we didn't bother spending two extra lines
to plug, which is kind of sad.
> builtin/fetch.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/fetch.c b/builtin/fetch.c
> index f9c41da..93c9938 100644
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -875,6 +875,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
> {
> int i;
> static const char **refs = NULL;
> + struct refspec *refspec;
> int ref_nr = 0;
> int exit_code;
>
> @@ -915,8 +916,9 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
>
> sigchain_push_common(unlock_pack_on_signal);
> atexit(unlock_pack);
> - exit_code = do_fetch(transport,
> - parse_fetch_refspec(ref_nr, refs), ref_nr);
> + refspec = parse_fetch_refspec(ref_nr, refs);
> + exit_code = do_fetch(transport, refspec, ref_nr);
> + free(refspec);
> transport_disconnect(transport);
> transport = NULL;
> return exit_code;
> --
> 1.7.6.rc0.293.g40857
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-09 0:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-08 20:06 [PATCH] fetch: do not leak a refspec Jim Meyering
2011-06-09 0:20 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).