commit - 6d9fc692504d4706fb0f347ff527a6998c927d27
commit + ae36ed87ca48b3896f6d21fa889d890a018b3fe1
blob - f1b6dcace641858a23e47b8eda4f3601731262ce
blob + 6eb9c20b441a20a8f481411a556fed4599773698
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
NULL) == -1)
return got_error_from_errno("pledge");
- if ((header = malloc(sizeof(struct gw_header))) == NULL)
+ if ((header = gw_init_header()) == NULL)
return got_error_from_errno("malloc");
error = gw_apply_unveil(gw_trans->gw_dir->path, NULL);
struct gw_header *header = NULL, *n_header = NULL;
enum kcgi_err kerr;
- if ((header = malloc(sizeof(struct gw_header))) == NULL)
+ if ((header = gw_init_header()) == NULL)
return got_error_from_errno("malloc");
if (pledge("stdio rpath proc exec sendfd unveil",
if (kerr != KCGI_OK)
error = gw_kcgi_error(kerr);
- got_ref_list_free(&header->refs);
+ if (header)
+ got_ref_list_free(&header->refs);
gw_free_headers(header);
TAILQ_FOREACH(n_header, &gw_trans->gw_headers, entry)
gw_free_headers(n_header);
struct gw_header *header = NULL, *n_header = NULL;
enum kcgi_err kerr;
- if ((header = malloc(sizeof(struct gw_header))) == NULL)
+ if ((header = gw_init_header()) == NULL)
return got_error_from_errno("malloc");
if (pledge("stdio rpath proc exec sendfd unveil",
if (kerr != KCGI_OK)
error = gw_kcgi_error(kerr);
- got_ref_list_free(&header->refs);
+ if (header)
+ got_ref_list_free(&header->refs);
gw_free_headers(header);
TAILQ_FOREACH(n_header, &gw_trans->gw_headers, entry)
gw_free_headers(n_header);
if (pledge("stdio rpath proc exec sendfd unveil", NULL) == -1)
return got_error_from_errno("pledge");
- if ((header = malloc(sizeof(struct gw_header))) == NULL)
+ if ((header = gw_init_header()) == NULL)
return got_error_from_errno("malloc");
error = gw_apply_unveil(gw_trans->gw_dir->path, NULL);
kerr = khttp_puts(gw_trans->gw_req, tree);
if (kerr != KCGI_OK)
error = gw_kcgi_error(kerr);
- got_ref_list_free(&header->refs);
+ if (header)
+ got_ref_list_free(&header->refs);
gw_free_headers(header);
free(tree_html_disp);
free(tree_html);
{
struct gw_header *header;
- if ((header = malloc(sizeof(*header))) == NULL)
+ header = malloc(sizeof(*header));
+ if (header == NULL)
return NULL;
header->repo = NULL;
header->commit = NULL;
header->id = NULL;
header->path = NULL;
+ SIMPLEQ_INIT(&header->refs);
return header;
}
if (error)
return error;
- SIMPLEQ_INIT(&header->refs);
-
if (gw_trans->commit == NULL) {
struct got_reference *head_ref;
error = got_ref_open(&head_ref, header->repo,