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 crash dereferencing freed pointer #951

Closed
Closed
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: 5 additions & 2 deletions src/modules/avformat/producer_avformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,12 @@ mlt_producer producer_avformat_init(mlt_profile profile, const char *service, ch

// Initialise it
if (mlt_producer_init(producer, self) == 0) {
self->parent = producer;

// Get the properties
mlt_properties properties = MLT_PRODUCER_PROPERTIES(producer);

self->parent = producer;
mlt_properties_inc_ref(properties);

// Set the resource property (required for all producers)
mlt_properties_set(properties, "resource", file);

Expand Down Expand Up @@ -3745,6 +3746,7 @@ static int producer_get_frame(mlt_producer producer, mlt_frame_ptr frame, int in
if (!self) {
self = calloc(1, sizeof(struct producer_avformat_s));
self->parent = producer;
mlt_properties_inc_ref(MLT_PRODUCER_PROPERTIES(producer));
mlt_service_cache_put(service,
"producer_avformat",
self,
Expand Down Expand Up @@ -3930,6 +3932,7 @@ static void producer_avformat_close(producer_avformat self)
self->vpackets = NULL;
}

mlt_properties_dec_ref(MLT_PRODUCER_PROPERTIES(self->parent));
free(self);
}

Expand Down
Loading