git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What's cooking in git.git (May 2013, #09; Wed, 29)

From
Thomas Rast <trast@inf.ethz.ch>
Date
May 30, 2013, 09:47 UTC
Message-ID
<87bo7slrz1.fsf@linux-k42r.v.cablecom.net>
In-Reply-To
<7va9ndqqyf.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 8 quoted lines
> * rr/die-on-missing-upstream (2013-05-22) 2 commits
>  - sha1_name: fix error message for @{<N>}, @{<date>}
>  - sha1_name: fix error message for @{u}
>
>  When a reflog notation is used for implicit "current branch", we
>  did not say which branch and worse said "branch ''".
>
>  Will merge to 'next'.
This interacts with the tests from
> * fc/at-head (2013-05-08) 13 commits
to fail valgrind in t1508 like so:
  ==22927== Invalid read of size 1
  ==22927==    at 0x4C2C71B: __GI_strnlen (mc_replace_strmem.c:377)
  ==22927==    by 0x567FF6B: vfprintf (in /lib64/libc-2.17.so)
  ==22927==    by 0x56AC194: vsnprintf (in /lib64/libc-2.17.so)
  ==22927==    by 0x4EAC39: vreportf (usage.c:12)
  ==22927==    by 0x4EACA4: die_builtin (usage.c:36)
  ==22927==    by 0x4EAEE0: die (usage.c:103)
  ==22927==    by 0x4D8C51: get_sha1_1 (sha1_name.c:542)
  ==22927==    by 0x4D8E5D: get_sha1_with_context_1 (sha1_name.c:1299)
  ==22927==    by 0x4D992A: get_sha1_with_context (sha1_name.c:1417)
  ==22927==    by 0x4D99E1: get_sha1 (sha1_name.c:1124)
  ==22927==    by 0x45E1AC: cmd_rev_parse (rev-parse.c:761)
  ==22927==    by 0x4051B3: handle_internal_command (git.c:284)
  ==22927==  Address 0x5bebccb is 11 bytes inside a block of size 22 free'd
  ==22927==    at 0x4C2ACDA: free (vg_replace_malloc.c:468)
  ==22927==    by 0x4D8C37: get_sha1_1 (sha1_name.c:541)
  ==22927==    by 0x4D8E5D: get_sha1_with_context_1 (sha1_name.c:1299)
  ==22927==    by 0x4D992A: get_sha1_with_context (sha1_name.c:1417)
  ==22927==    by 0x4D99E1: get_sha1 (sha1_name.c:1124)
  ==22927==    by 0x45E1AC: cmd_rev_parse (rev-parse.c:761)
  ==22927==    by 0x4051B3: handle_internal_command (git.c:284)
  ==22927==    by 0x4053E7: main (git.c:492)

I think it's enough to squash this little change; leaking some memory immediately before die() is not too bad, especially if we're going to pass real_ref+11 into die()...

diff --git i/sha1_name.c w/sha1_name.c
index 5ea16ff..a07558d 100644
--- i/sha1_name.c
+++ w/sha1_name.c
@@ -538,7 +538,6 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
 					"back to %s.", len, str,
 					show_date(co_time, co_tz, DATE_RFC2822));
 			else {
-				free(real_ref);
 				die("Log for '%.*s' only has %d entries.",
 				    len, str, co_cnt);
 			}
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Junio C HamanoNext: Ramkumar Ramachandra
Message 2 of 23 in “What's cooking in git.git (May 2013, #09; Wed, 29)”
  1. Junio C HamanoMay 29, 2013
  2. Thomas RastMay 30, 2013
  3. Ramkumar RamachandraMay 30, 2013
  4. Junio C HamanoJun 2, 2013
  5. Jens LehmannMay 30, 2013
  6. Junio C HamanoJun 2, 2013
  7. Jens LehmannJun 3, 2013
  8. Junio C HamanoJul 1, 2013
  9. Jens LehmannMay 30, 2013
  10. John KeepingMay 31, 2013
  11. John KeepingJun 3, 2013
  12. Junio C HamanoJun 3, 2013
  13. Jens LehmannJun 3, 2013
  14. John KeepingJun 3, 2013
  15. Heiko VoigtJun 4, 2013
  16. John KeepingJun 4, 2013
  17. Heiko VoigtJun 4, 2013
  18. John KeepingJun 4, 2013
  19. Jens LehmannJun 4, 2013
  20. John KeepingJun 4, 2013
  21. Phil HordJun 4, 2013
  22. John KeepingJun 5, 2013
  23. Øystein WalleMay 31, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.