Skip to content
  • Thomas Rast's avatar
    apply: carefully strdup a possibly-NULL name · 212eb96a
    Thomas Rast authored and Junio C Hamano's avatar Junio C Hamano committed
    2901bbe5
    
     (apply: free patch->{def,old,new}_name fields, 2012-03-21)
    cleaned up the memory management of filenames in the patches, but
    forgot that find_name_traditional() can return NULL as a way of saying
    "I couldn't find a name".
    
    That NULL unfortunately gets passed into xstrdup() next, resulting in
    a segfault.  Use null_strdup() so as to safely propagate the null,
    which will let us emit the correct error message.
    
    Reported-by: DevHC on #git
    Signed-off-by: default avatarThomas Rast <trast@inf.ethz.ch>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    212eb96a