• J
    remote: make copy_ref() perform a deep copy · 7b3db095
    Jay Soffian 提交于
    To ensure that copied refs can always be freed w/o causing a
    double-free, make copy_ref() perform a deep copy.
    
    Also have copy_ref() return NULL if asked to copy NULL to simplify
    things for the caller.
    
    Background: currently copy_ref() performs a shallow copy. This is fine
    for current callers who never free the result and/or only copy refs
    which contain NULL pointers. But copy_ref() is about to gain a new
    caller (guess_remote_head()) which copies refs where peer_ref is not
    NULL and the caller of guess_remote_head() will want to free the result.
    Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    7b3db095
remote.c 34.7 KB