git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Don't allocate too much memory in quote_ref_url
@ 2008-06-14 10:02 Mike Hommey
  0 siblings, 0 replies; only message in thread
From: Mike Hommey @ 2008-06-14 10:02 UTC (permalink / raw)
  To: git, gitster

In c13b263, http_fetch_ref got "refs/" included in the ref passed to it,
which, incidentally, makes the allocation in quote_ref_url too big, now.
---

I noticed this when rebasing some of my private branches onto current
master. I had a commit similar to c13b263 that ended up conflicting,
and after conflict resolving, this is all that was left, which is
an obvious change that was lacking there.

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

diff --git a/http.c b/http.c
index bc14bdb..9b6d5ed 100644
--- a/http.c
+++ b/http.c
@@ -583,7 +583,7 @@ static char *quote_ref_url(const char *base, const char *ref)
 	int len, baselen, ch;
 
 	baselen = strlen(base);
-	len = baselen + 7; /* "/refs/" + NUL */
+	len = baselen + 2;
 	for (cp = ref; (ch = *cp) != 0; cp++, len++)
 		if (needs_quote(ch))
 			len += 2; /* extra two hex plus replacement % */
-- 
1.5.5.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-14 10:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-14 10:02 [PATCH] Don't allocate too much memory in quote_ref_url Mike Hommey

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).