All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] * remote.c (valid_fetch_refspec): remove useless if-before-free test
@ 2008-08-19 18:46 Jim Meyering
  2008-08-20 19:40 ` Alex Riesen
  2008-08-20 23:38 ` Brandon Casey
  0 siblings, 2 replies; 8+ messages in thread
From: Jim Meyering @ 2008-08-19 18:46 UTC (permalink / raw)
  To: git list

We removed a handful of these useless if-before-free tests
several months ago.  This change removes a new one that snuck back in.

Signed-off-by: Jim Meyering <meyering@redhat.com>
---
There are four in regex.c, too, but that's imported code,
so probably not worth modifying in git:

    compat/regex.c: if (var) free (var)
    compat/regex.c: if (preg->buffer != NULL)
        free (preg->buffer)
    compat/regex.c: if (preg->fastmap != NULL)
        free (preg->fastmap)
    compat/regex.c: if (preg->translate != NULL)
        free (preg->translate)

 remote.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/remote.c b/remote.c
index f61a3ab..105668f 100644
--- a/remote.c
+++ b/remote.c
@@ -579,8 +579,7 @@ int valid_fetch_refspec(const char *fetch_refspec_str)
 	struct refspec *refspec;

 	refspec = parse_refspec_internal(1, fetch_refspec, 1, 1);
-	if (refspec)
-		free(refspec);
+	free(refspec);
 	return !!refspec;
 }

--
1.6.0.9.gae2e487

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-08-22  0:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-19 18:46 [PATCH] * remote.c (valid_fetch_refspec): remove useless if-before-free test Jim Meyering
2008-08-20 19:40 ` Alex Riesen
2008-08-20 20:22   ` Jim Meyering
2008-08-20 23:38 ` Brandon Casey
2008-08-21  0:16   ` Junio C Hamano
2008-08-21  0:33     ` Brandon Casey
2008-08-21  2:42       ` Junio C Hamano
2008-08-22  0:16         ` [PATCH] remote.c: add a function for deleting a refspec array and use it (twice) Brandon Casey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.