I recently tried to run the git test suite with --valgrind.
Unfortunately it didn't come back completely clean.  This patch series
fixes a bunch of these errors, although unfortunately not quite all of
them yet.

The remaining failures are in

t0021.15 - This one is not actually valgrind complaining about
something, but the clean/smudge script not writing debug.log for some
reason.  I'm not quite sure what exactly is going on here.
t0021.25, t0021.26 - This is an actual uninitialized memory usage:

==4751== Conditional jump or move depends on uninitialised value(s)
==4751==    at 0x2796D5: fill_stat_cache_info (read-cache.c:153)
==4751==    by 0x2218A2: write_entry (entry.c:359)
==4751==    by 0x221D42: checkout_entry (entry.c:458)
==4751==    by 0x2EB627: check_updates (unpack-trees.c:382)
==4751==    by 0x2EDBA1: unpack_trees (unpack-trees.c:1380)
==4751==    by 0x13797E: checkout (clone.c:750)
==4751==    by 0x138FF4: cmd_clone (clone.c:1194)
==4751==    by 0x11A6F2: run_builtin (git.c:342)
==4751==    by 0x11A9E8: handle_builtin (git.c:550)
==4751==    by 0x11ABCC: run_argv (git.c:602)
==4751==    by 0x11AD8E: cmd_main (git.c:679)
==4751==    by 0x1BF125: main (common-main.c:43)
==4751==  Uninitialised value was created by a stack allocation
==4751==    at 0x2212B4: write_entry (entry.c:254)
==4751== 

So far I've tracked this one down to the lstat call in write_entry
failing, and thus not filling struct stat_info.  I'm not quite sure
yet about the best workaround for that (and I'm not very familiar with
the clean/smudge code).  I'll keep digging what the problem there is.

There's also one test that's unexpectedly passing when the test suite
is run under valgrind (t6410.) but I haven't dug into what's up with
that yet.

These patches could be applied by themselves as well, but since they
work toward the same goal, and a cover letter would explain where
these are coming from I decided to make them into a patch series.

Thomas Gummerer (3):
  path.c: fix uninitialized memory access
  http-push: fix construction of hex value from path
  sub-process: allocate argv on the heap

 http-push.c   |  2 +-
 path.c        | 19 ++++++++++---------
 sub-process.c |  4 +++-
 3 files changed, 14 insertions(+), 11 deletions(-)

-- 
2.14.1.480.gb18f417b89

Reply via email to