diff options
Diffstat (limited to 'ui-refs.c')
-rw-r--r-- | ui-refs.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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(" "); | 126 | html(" "); |
124 | } | 127 | } |
128 | |||
129 | if (free_ref) | ||
130 | free((char *)ref); | ||
125 | } | 131 | } |
126 | static int print_tag(struct refinfo *ref) | 132 | static int print_tag(struct refinfo *ref) |
127 | { | 133 | { |
@@ -205,6 +211,8 @@ void cgit_print_branches(int maxcount) | |||
205 | 211 | ||
206 | if (maxcount < list.count) | 212 | if (maxcount < list.count) |
207 | print_refs_link("heads"); | 213 | print_refs_link("heads"); |
214 | |||
215 | cgit_free_reflist_inner(&list); | ||
208 | } | 216 | } |
209 | 217 | ||
210 | void cgit_print_tags(int maxcount) | 218 | void cgit_print_tags(int maxcount) |
@@ -229,6 +237,8 @@ void cgit_print_tags(int maxcount) | |||
229 | 237 | ||
230 | if (maxcount < list.count) | 238 | if (maxcount < list.count) |
231 | print_refs_link("tags"); | 239 | print_refs_link("tags"); |
240 | |||
241 | cgit_free_reflist_inner(&list); | ||
232 | } | 242 | } |
233 | 243 | ||
234 | void cgit_print_refs() | 244 | void cgit_print_refs() |