• J
    fix memory leak parsing core.commentchar · 649409b7
    Jeff King 提交于
    When we see the core.commentchar config option, we extract
    the string with git_config_string, which does two things:
    
      1. It complains via config_error_nonbool if there is no
         string value.
    
      2. It makes a copy of the string.
    
    Since we immediately parse the string into its
    single-character value, we only care about (1). And in fact
    (2) is a detriment, as it means we leak the copy. Instead,
    let's just check the pointer value ourselves, and parse
    directly from the const string we already have.
    Signed-off-by: NJeff King <peff@peff.net>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    649409b7
config.c 43.4 KB