mirror of
https://github.com/git/git.git
synced 2026-03-17 04:00:11 +01:00
Merge branch 'jp/get-ref-dir-unsorted' into next
* jp/get-ref-dir-unsorted: refs.c: free duplicate entries in the ref array instead of leaking them refs.c: abort ref search if ref array is empty refs.c: ensure struct whose member may be passed to realloc is initialized Conflicts: refs.c
This commit is contained in:
4
refs.c
4
refs.c
@@ -96,6 +96,7 @@ static void sort_ref_array(struct ref_array *array)
|
||||
die("Duplicated ref, and SHA1s don't match: %s",
|
||||
a->name);
|
||||
warning("Duplicated ref: %s", a->name);
|
||||
free(b);
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
@@ -112,6 +113,9 @@ static struct ref_entry *search_ref_array(struct ref_array *array, const char *n
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!array->nr)
|
||||
return NULL;
|
||||
|
||||
len = strlen(name) + 1;
|
||||
e = xmalloc(sizeof(struct ref_entry) + len);
|
||||
memcpy(e->name, name, len);
|
||||
|
||||
Reference in New Issue
Block a user