mirror of
https://github.com/git/git
synced 2024-11-04 16:17:49 +00:00
mailmap: always store allocated strings in mailmap blob
Same as with the preceding commit, the `git_mailmap_blob` may sometimes contain an allocated string and sometimes it may contain a string constant. This is risky and can easily lead to bugs in case the variable is getting re-assigned, where the code may then try to free the previous value to avoid memory leaks. Safeguard the code by always storing allocated strings in the variable. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
844d190677
commit
c77756015e
1 changed files with 1 additions and 1 deletions
|
@ -216,7 +216,7 @@ int read_mailmap(struct string_list *map)
|
|||
map->cmp = namemap_cmp;
|
||||
|
||||
if (!git_mailmap_blob && is_bare_repository())
|
||||
git_mailmap_blob = "HEAD:.mailmap";
|
||||
git_mailmap_blob = xstrdup("HEAD:.mailmap");
|
||||
|
||||
if (!startup_info->have_repository || !is_bare_repository())
|
||||
err |= read_mailmap_file(map, ".mailmap",
|
||||
|
|
Loading…
Reference in a new issue