summaryrefslogtreecommitdiff
path: root/reflog-walk.c
diff options
context:
space:
mode:
Diffstat (limited to 'reflog-walk.c')
-rw-r--r--reflog-walk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/reflog-walk.c b/reflog-walk.c
index 5d81d39a52..da71a85851 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -51,8 +51,11 @@ static struct complete_reflogs *read_complete_reflog(const char *ref)
if (reflogs->nr == 0) {
unsigned char sha1[20];
const char *name = resolve_ref(ref, sha1, 1, NULL);
- if (name)
+ if (name) {
+ name = xstrdup(name);
for_each_reflog_ent(name, read_one_reflog, reflogs);
+ free((char *)name);
+ }
}
if (reflogs->nr == 0) {
int len = strlen(ref);