Skip to content

Commit 1401236

Browse files
committed
Merge branch 'km/fetch-do-not-free-remote-name' into maint
The ownership rule for the piece of memory that hold references to be fetched in "git fetch" was screwy, which has been cleaned up. * km/fetch-do-not-free-remote-name: builtin/fetch.c: don't free remote->name after fetch
2 parents 5f30bb4 + b7410f6 commit 1401236

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

builtin/fetch.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ static int get_remote_group(const char *key, const char *value, void *priv)
10051005
size_t wordlen = strcspn(value, " \t\n");
10061006

10071007
if (wordlen >= 1)
1008-
string_list_append(g->list,
1008+
string_list_append_nodup(g->list,
10091009
xstrndup(value, wordlen));
10101010
value += wordlen + (value[wordlen] != '\0');
10111011
}
@@ -1143,7 +1143,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
11431143
int cmd_fetch(int argc, const char **argv, const char *prefix)
11441144
{
11451145
int i;
1146-
struct string_list list = STRING_LIST_INIT_NODUP;
1146+
struct string_list list = STRING_LIST_INIT_DUP;
11471147
struct remote *remote;
11481148
int result = 0;
11491149
struct argv_array argv_gc_auto = ARGV_ARRAY_INIT;
@@ -1226,8 +1226,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
12261226
argv_array_clear(&options);
12271227
}
12281228

1229-
/* All names were strdup()ed or strndup()ed */
1230-
list.strdup_strings = 1;
12311229
string_list_clear(&list, 0);
12321230

12331231
close_all_packs();

0 commit comments

Comments
 (0)