aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui-refs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ui-refs.c b/ui-refs.c
index 4a9b8d3..e89f836 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -103,6 +103,7 @@ static void print_tag_downloads(const struct cgit_repo *repo, const char *ref)
103 const struct cgit_snapshot_format* f; 103 const struct cgit_snapshot_format* f;
104 char *filename; 104 char *filename;
105 const char *basename; 105 const char *basename;
106 int free_ref = 0;
106 107
107 if (!ref || strlen(ref) < 2) 108 if (!ref || strlen(ref) < 2)
108 return; 109 return;
@@ -111,8 +112,10 @@ static void print_tag_downloads(const struct cgit_repo *repo, const char *ref)
111 if (prefixcmp(ref, basename) != 0) { 112 if (prefixcmp(ref, basename) != 0) {
112 if ((ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1])) 113 if ((ref[0] == 'v' || ref[0] == 'V') && isdigit(ref[1]))
113 ref++; 114 ref++;
114 if (isdigit(ref[0])) 115 if (isdigit(ref[0])) {
115 ref = xstrdup(fmt("%s-%s", basename, ref)); 116 ref = xstrdup(fmt("%s-%s", basename, ref));
117 free_ref = 1;
118 }
116 } 119 }
117 120
118 for (f = cgit_snapshot_formats; f->suffix; f++) { 121 for (f = cgit_snapshot_formats; f->suffix; f++) {
@@ -122,6 +125,9 @@ static void print_tag_downloads(const struct cgit_repo *repo, const char *ref)
122 cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename); 125 cgit_snapshot_link(filename, NULL, NULL, NULL, NULL, filename);
123 html("&nbsp;&nbsp;"); 126 html("&nbsp;&nbsp;");
124 } 127 }
128
129 if (free_ref)
130 free((char *)ref);
125} 131}
126static int print_tag(struct refinfo *ref) 132static int print_tag(struct refinfo *ref)
127{ 133{