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

Re: parsecvs and unnamed branches

From
PRPavel Roskin <proski@gnu.org>
Date
Jun 17, 2006, 04:08 UTC
Message-ID
<1150517336.9144.8.camel@dv>
In-Reply-To
<9e4733910606162031o69df27fdje50c88949ed990b5@mail.gmail.com>
On Fri, 2006-06-16 at 23:31 -0400, Jon Smirl wrote:
> Parsecvs was compiled '-O2 -g' why didn't it decode the addresses to symbols?

Sorry, I was too quick to put blame on you. Maybe glibc can only list its own symbols.

I could reproduce the problem trivially with a single file, and here's what Valgrind says:

==11154== Invalid free() / delete / delete[] ==11154== at 0x4905423: free (vg_replace_malloc.c:233) ==11154== by 0x40C136: git_pack_directory (git.c:620) ==11154== by 0x40C1B4: git_rev_list_pack (git.c:639) ==11154== by 0x4067DA: main (parsecvs.c:785)

git_pack_directory() tries to free() the result of git_system_to_string(), which is in turn a result of atom(). My understanding is that atoms should not be freed. They are not freed in other cases.

Patch:
diff --git a/README b/README
diff --git a/git.c b/git.c
index 33b29c7..7312568 100644
--- a/git.c
+++ b/git.c
@@ -617,7 +617,6 @@ git_pack_directory (void)
 	}
 	free (objects_dir);
 	pack_dir = git_format_command ("%s/objects/pack", git_dir);
-        free (git_dir);
 	if (!pack_dir)
 	    return NULL;
 	if (access (pack_dir, F_OK) == -1 &&
-- 
Regards,
Pavel Roskin
Previous: Jon SmirlNext: Jon Smirl
Message 9 of 14 in “parsecvs and unnamed branches”
  1. Jon SmirlJun 16, 2006
  2. Keith PackardJun 16, 2006
  3. Jon SmirlJun 16, 2006
  4. Jon SmirlJun 16, 2006
  5. Keith PackardJun 16, 2006
  6. Jon SmirlJun 17, 2006
  7. Pavel RoskinJun 17, 2006
  8. Jon SmirlJun 17, 2006
  9. Pavel RoskinJun 17, 2006
  10. Jon SmirlJun 17, 2006
  11. Pavel RoskinJun 17, 2006
  12. Keith PackardJun 17, 2006
  13. Jon SmirlJun 17, 2006
  14. Keith PackardJun 17, 2006

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.