diff options
-rw-r--r-- | cgit.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -427,6 +427,12 @@ static int find_current_ref(const char *refname, const unsigned char *sha1, | |||
427 | return info->match; | 427 | return info->match; |
428 | } | 428 | } |
429 | 429 | ||
430 | static void free_refmatch_inner(struct refmatch *info) | ||
431 | { | ||
432 | if (info->first_ref) | ||
433 | free(info->first_ref); | ||
434 | } | ||
435 | |||
430 | static char *find_default_branch(struct cgit_repo *repo) | 436 | static char *find_default_branch(struct cgit_repo *repo) |
431 | { | 437 | { |
432 | struct refmatch info; | 438 | struct refmatch info; |
@@ -442,6 +448,8 @@ static char *find_default_branch(struct cgit_repo *repo) | |||
442 | ref = info.first_ref; | 448 | ref = info.first_ref; |
443 | if (ref) | 449 | if (ref) |
444 | ref = xstrdup(ref); | 450 | ref = xstrdup(ref); |
451 | free_refmatch_inner(&info); | ||
452 | |||
445 | return ref; | 453 | return ref; |
446 | } | 454 | } |
447 | 455 | ||