ctx->page.etag = NULL;
memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list));
if (ctx->env.script_name)
- ctx->cfg.script_name = ctx->env.script_name;
+ ctx->cfg.script_name = xstrdup(ctx->env.script_name);
if (ctx->env.query_string)
- ctx->qry.raw = ctx->env.query_string;
+ ctx->qry.raw = xstrdup(ctx->env.query_string);
if (!ctx->env.cgit_config)
ctx->env.cgit_config = CGIT_CONFIG;
}
return info->match;
}
+static void free_refmatch_inner(struct refmatch *info)
+{
+ if (info->first_ref)
+ free(info->first_ref);
+}
+
static char *find_default_branch(struct cgit_repo *repo)
{
struct refmatch info;
ref = info.first_ref;
if (ref)
ref = xstrdup(ref);
+ free_refmatch_inner(&info);
+
return ref;
}