Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
builtin/fetch.c: don't free remote->name after fetch
author
Keith McGuigan
<kmcguigan@twopensource.com>
Tue, 14 Jun 2016 18:28:56 +0000
(14:28 -0400)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 14 Jun 2016 18:58:05 +0000
(11:58 -0700)
Make fetch's string_list of remote names own all of its string items
(strdup'ing when necessary) so that it can deallocate them safely
when clearing.
Signed-off-by: Keith McGuigan <kmcguigan@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
0b65a8d
)
diff --git
a/builtin/fetch.c
b/builtin/fetch.c
index e4639d8eb1d5fda586520f10271c05a0897f2ea5..377a68514ac40dd8b3f5336eb9996b12a88eec68 100644
(file)
--- a/
builtin/fetch.c
+++ b/
builtin/fetch.c
@@
-1005,7
+1005,7
@@
static int get_remote_group(const char *key, const char *value, void *priv)
size_t wordlen = strcspn(value, " \t\n");
if (wordlen >= 1)
size_t wordlen = strcspn(value, " \t\n");
if (wordlen >= 1)
- string_list_append(g->list,
+ string_list_append
_nodup
(g->list,
xstrndup(value, wordlen));
value += wordlen + (value[wordlen] != '\0');
}
xstrndup(value, wordlen));
value += wordlen + (value[wordlen] != '\0');
}
@@
-1143,7
+1143,7
@@
static int fetch_one(struct remote *remote, int argc, const char **argv)
int cmd_fetch(int argc, const char **argv, const char *prefix)
{
int i;
int cmd_fetch(int argc, const char **argv, const char *prefix)
{
int i;
- struct string_list list = STRING_LIST_INIT_
NO
DUP;
+ struct string_list list = STRING_LIST_INIT_DUP;
struct remote *remote;
int result = 0;
struct argv_array argv_gc_auto = ARGV_ARRAY_INIT;
struct remote *remote;
int result = 0;
struct argv_array argv_gc_auto = ARGV_ARRAY_INIT;
@@
-1226,8
+1226,6
@@
int cmd_fetch(int argc, const char **argv, const char *prefix)
argv_array_clear(&options);
}
argv_array_clear(&options);
}
- /* All names were strdup()ed or strndup()ed */
- list.strdup_strings = 1;
string_list_clear(&list, 0);
close_all_packs();
string_list_clear(&list, 0);
close_all_packs();