Skip to content
  • Jonathan Nieder's avatar
    init: plug tiny one-time memory leak · 9173912b
    Jonathan Nieder authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    The buffer used to construct paths like ".git/objects/info" and
    ".git/objects/pack" is allocated on the heap and never freed.
    
    So free it.  While at it, factor out the relevant code into its own
    function and rename the sha1_dir variable to object_directory (to
    match the change in everyday usage after the renaming of
    SHA1_FILE_DIRECTORY in v0.99~603^2~7, 2005).
    
    Noticed by valgrind while setting up tests (in test-lib).
    
    Signed-off-by: default avatarJonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    9173912b