Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leak in Redcarpet::Render::Base #516

Merged
merged 1 commit into from
Sep 23, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ext/redcarpet/rc_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,16 @@ static void rb_redcarpet_rbase_mark(struct rb_redcarpet_rndr *rndr)
rb_gc_mark(rndr->options.link_attributes);
}

static void rndr_deallocate(void *rndr)
{
xfree(rndr);
}

static VALUE rb_redcarpet_rbase_alloc(VALUE klass)
{
struct rb_redcarpet_rndr *rndr = ALLOC(struct rb_redcarpet_rndr);
memset(rndr, 0x0, sizeof(struct rb_redcarpet_rndr));
return Data_Wrap_Struct(klass, rb_redcarpet_rbase_mark, NULL, rndr);
return Data_Wrap_Struct(klass, rb_redcarpet_rbase_mark, rndr_deallocate, rndr);
}

static void rb_redcarpet__overload(VALUE self, VALUE base_class)
Expand Down