Commit f2bbb58b authored by Hannes Domani's avatar Hannes Domani Committed by Rémi Denis-Courmont

vout: fix memory leaks

In combination with the previous patch all crashes (double free()) are solved.
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
(cherry picked from commit 1651d75c07ae1795cf78b0e3e4ac753b7703a8e6)
parent 3e254383
...@@ -147,6 +147,9 @@ static void vout_display_Delete(vout_display_t *vd) ...@@ -147,6 +147,9 @@ static void vout_display_Delete(vout_display_t *vd)
if (vd->module) if (vd->module)
module_unneed(vd, vd->module); module_unneed(vd, vd->module);
video_format_Clean(&vd->source);
video_format_Clean(&vd->fmt);
vlc_object_release(vd); vlc_object_release(vd);
} }
...@@ -475,19 +478,20 @@ static void VoutDisplayCreateRender(vout_display_t *vd) ...@@ -475,19 +478,20 @@ static void VoutDisplayCreateRender(vout_display_t *vd)
es_format_InitFromVideo(&src, &v_src); es_format_InitFromVideo(&src, &v_src);
/* */ /* */
es_format_t dst;
filter_t *filter; filter_t *filter;
for (int i = 0; i < 1 + (v_dst_cmp.i_chroma != v_dst.i_chroma); i++) { for (int i = 0; i < 1 + (v_dst_cmp.i_chroma != v_dst.i_chroma); i++) {
es_format_t dst;
es_format_InitFromVideo(&dst, i == 0 ? &v_dst : &v_dst_cmp); es_format_InitFromVideo(&dst, i == 0 ? &v_dst : &v_dst_cmp);
filter_chain_Reset(osys->filters, &src, &dst); filter_chain_Reset(osys->filters, &src, &dst);
filter = filter_chain_AppendFilter(osys->filters, filter = filter_chain_AppendFilter(osys->filters,
NULL, NULL, &src, &dst); NULL, NULL, &src, &dst);
es_format_Clean(&dst);
if (filter) if (filter)
break; break;
} }
es_format_Clean(&src);
if (!filter) if (!filter)
msg_Err(vd, "Failed to adapt decoder format to display"); msg_Err(vd, "Failed to adapt decoder format to display");
} }
......
...@@ -806,6 +806,8 @@ static void ThreadChangeFilters(vout_thread_t *vout, ...@@ -806,6 +806,8 @@ static void ThreadChangeFilters(vout_thread_t *vout,
} }
} }
es_format_Clean(&fmt_target);
if (vout->p->filter.configuration != filters) { if (vout->p->filter.configuration != filters) {
free(vout->p->filter.configuration); free(vout->p->filter.configuration);
vout->p->filter.configuration = filters ? strdup(filters) : NULL; vout->p->filter.configuration = filters ? strdup(filters) : NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment