• J
    git-config: fix regexp memory leaks on error conditions · 97ed50f9
    Jeff King 提交于
    The get_value function has a goto label for cleaning up on
    errors, but it only cleans up half of what the function
    might allocate. Let's also clean up the key and regexp
    variables there.
    
    Note that we need to take special care when compiling the
    regex fails to clean it up ourselves, since it is in a
    half-constructed state (we would want to free it, but not
    regfree it).
    
    Similarly, we fix git_config_parse_key to return NULL when
    it fails, not a pointer to some already-freed memory.
    Signed-off-by: NJeff King <peff@peff.net>
    97ed50f9
config.c 37.7 KB