Skip to content

Commit 66ce036

Browse files
mhaggergitster
authored andcommitted
exclude_existing(): set existing_refs.strdup_strings
The each_ref_fn add_existing() adds refnames to the existing_refs list. But the lifetimes of these refnames is not guaranteed by the refs API, so configure the string_list to make copies as it adds them. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8c46bf9 commit 66ce036

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/show-ref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static int add_existing(const char *refname, const unsigned char *sha1, int flag
103103
*/
104104
static int exclude_existing(const char *match)
105105
{
106-
static struct string_list existing_refs = STRING_LIST_INIT_NODUP;
106+
static struct string_list existing_refs = STRING_LIST_INIT_DUP;
107107
char buf[1024];
108108
int matchlen = match ? strlen(match) : 0;
109109

0 commit comments

Comments
 (0)