aboutsummaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-13 22:37:26 +0900
committerJunio C Hamano <gitster@pobox.com>2018-11-13 22:37:26 +0900
commitf22838aa7a6dcf308a3307ba17f8afa40989ad3a (patch)
treef7e4b72da742a8e1fb4d86a2a17e9ff103841e5f /dir.c
parente146cc97be4c054c60d38e9f4edcdc33205bf563 (diff)
parentaa097b88e91bd748c4508b042e618e8292e15ad5 (diff)
downloadgit-f22838aa7a6dcf308a3307ba17f8afa40989ad3a.tar.gz
Merge branch 'jk/misc-unused-fixes'
Assorted fixes for bugs found while auditing -Wunused-parameter warnings. * jk/misc-unused-fixes: approxidate: fix NULL dereference in date_time() pathspec: handle non-terminated strings with :(attr) approxidate: handle pending number for "specials" rev-list: handle flags for --indexed-objects
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/dir.c b/dir.c
index 47c2fca8dc..ab6477d777 100644
--- a/dir.c
+++ b/dir.c
@@ -281,8 +281,15 @@ static int match_attrs(const struct index_state *istate,
const struct pathspec_item *item)
{
int i;
+ char *to_free = NULL;
+
+ if (name[namelen])
+ name = to_free = xmemdupz(name, namelen);
git_check_attr(istate, name, item->attr_check);
+
+ free(to_free);
+
for (i = 0; i < item->attr_match_nr; i++) {
const char *value;
int matched;