[vlc-commits] [Git][videolan/vlc][master] dynamicoverlay: Fix memory leak when updating pictures
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sun Aug 7 14:37:13 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
41c1d1a9 by Alex Chernyakov at 2022-08-07T14:20:28+00:00
dynamicoverlay: Fix memory leak when updating pictures
In exec_DataSharedMem() memory is allocated via the call to picture_New().
This memory is correctly freed via picture_Release() if an error occurs,
but if no error occurs and the function proceeds normally, the memory is
never freed. When the DataSharedMem routine is called repeatedly (e.g.,
to update a picture continuously), this leak accumulates very quickly.
- - - - -
1 changed file:
- modules/spu/dynamicoverlay/dynamicoverlay_commands.c
Changes:
=====================================
modules/spu/dynamicoverlay/dynamicoverlay_commands.c
=====================================
@@ -58,12 +58,15 @@ overlay_t *OverlayCreate( void )
0, 0, 1, 1 );
p_ovl->p_fontstyle = text_style_Create( STYLE_NO_DEFAULTS );
p_ovl->data.p_text = NULL;
+ p_ovl->data.p_pic = NULL;
return p_ovl;
}
int OverlayDestroy( overlay_t *p_ovl )
{
+ if( p_ovl->data.p_pic != NULL )
+ picture_Release( p_ovl->data.p_pic );
free( p_ovl->data.p_text );
text_style_Delete( p_ovl->p_fontstyle );
@@ -492,6 +495,9 @@ static int exec_DataSharedMem( filter_t *p_filter,
uint8_t *p_data, *p_in;
size_t i_neededsize = 0;
+ if( p_ovl->data.p_pic != NULL )
+ picture_Release( p_ovl->data.p_pic );
+
p_ovl->data.p_pic = picture_New( p_params->fourcc,
p_params->i_width, p_params->i_height,
1, 1 );
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/41c1d1a9eee6f580273cafff30e01abdf3d5ad2d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/41c1d1a9eee6f580273cafff30e01abdf3d5ad2d
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list