rugged
rugged copied to clipboard
Check for strings before attempting to xfree them
The rugged_rb_ary_to_strarray function uses xmalloc to allocate memory for str_array->strings, but there are several cases where this memory might not be allocated:
If rb_array is NIL_P, the function returns early with strings = NULL. If there's an empty array, the count would be 0. However, in the cleanup sections, the code unconditionally calls xfree(custom_headers.strings) without checking if it's NULL. This can cause "munmap_chunk(): invalid pointer" errors.
Should fix https://github.com/libgit2/rugged/issues/859
@carlosmn Look ok?