Skip to content

Commit

Permalink
Fix an attempt to free up the icalcomponents twice. We free the
Browse files Browse the repository at this point in the history
icalparser instead.
  • Loading branch information
minfrin committed Nov 26, 2015
1 parent 74473fc commit 12b2837
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

Changes with v0.0.4

*) Fix an attempt to free up the icalcomponents twice. We free the
icalparser instead. [Graham Leggett <minfrin@sharp.fm>]

Changes with v0.0.3

Expand Down
23 changes: 3 additions & 20 deletions mod_ical.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,6 @@ static apr_status_t icalparser_cleanup(void *data)
return APR_SUCCESS;
}

static apr_status_t icalcomponent_cleanup(void *data)
{
icalcomponent *comp = data;
icalcomponent_free(comp);
return APR_SUCCESS;
}

static apr_status_t jsonbuffer_cleanup(void *data)
{
json_object *buf = data;
Expand Down Expand Up @@ -2068,7 +2061,6 @@ static icalcomponent *add_line(ap_filter_t *f, ical_ctx *ctx)
char *buffer;
apr_off_t actual;
apr_size_t total;
icalcomponent *comp;

/* flatten the brigade, terminate with NUL */
apr_brigade_length(ctx->tmp, 1, &actual);
Expand All @@ -2081,15 +2073,7 @@ static icalcomponent *add_line(ap_filter_t *f, ical_ctx *ctx)
apr_brigade_cleanup(ctx->tmp);

/* handle line in ctx->tmp */
comp = icalparser_add_line(ctx->parser, buffer);

/* clean up the component */
if (comp) {
apr_pool_cleanup_register(f->r->pool, comp, icalcomponent_cleanup,
apr_pool_cleanup_null);
}

return comp;
return icalparser_add_line(ctx->parser, buffer);
}

static apr_status_t ical_header(ap_filter_t *f)
Expand Down Expand Up @@ -2344,7 +2328,8 @@ static apr_status_t ical_out_filter(ap_filter_t *f, apr_bucket_brigade *bb)
return rv;
}

apr_pool_cleanup_run(f->r->pool, comp, icalcomponent_cleanup);
apr_pool_cleanup_run(f->r->pool, ctx->parser, icalparser_cleanup);
ctx->parser = NULL;
}

/* pass the EOS across */
Expand Down Expand Up @@ -2415,8 +2400,6 @@ static apr_status_t ical_out_filter(ap_filter_t *f, apr_bucket_brigade *bb)
}

rv = ap_pass_brigade(f->next, ctx->bb);
apr_pool_cleanup_run(f->r->pool, comp,
icalcomponent_cleanup);
}
continue;
}
Expand Down

0 comments on commit 12b2837

Please sign in to comment.