aboutsummaryrefslogtreecommitdiff
path: root/ref-filter.c
diff options
context:
space:
mode:
Diffstat (limited to 'ref-filter.c')
-rw-r--r--ref-filter.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ref-filter.c b/ref-filter.c
index f5f0cb4ad6..9589418c25 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -2213,13 +2213,12 @@ static const char *lstrip_ref_components(const char *refname, int len)
static const char *rstrip_ref_components(const char *refname, int len)
{
int remaining = normalize_component_count(refname, len);
- const char *start = xstrdup(refname);
- const char *to_free = start;
+ char *start = xstrdup(refname);
while (remaining-- > 0) {
char *p = strrchr(start, '/');
if (!p) {
- free((char *)to_free);
+ free(start);
return xstrdup("");
} else
p[0] = '\0';