Skip to content

Commit

Permalink
image: check decoder validity before clearing fmt_in
Browse files Browse the repository at this point in the history
The input format must then only be cleared when a decoder is present.
Decoder not being set is a perfectly valid scenario when only generating
an image.

This patch address a crash introduced by 08b2486
  • Loading branch information
AlaricSenat authored and jbkempf committed Nov 20, 2022
1 parent 61eff32 commit a23ccf2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/misc/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ void image_HandlerDelete( image_handler_t *p_image )
{
if( !p_image ) return;

struct decoder_owner *p_owner = dec_get_owner( p_image->p_dec );
es_format_Clean( &p_owner->fmt_in );
decoder_Destroy( p_image->p_dec );
if( p_image->p_dec != NULL )
{
struct decoder_owner *p_owner = dec_get_owner( p_image->p_dec );
es_format_Clean( &p_owner->fmt_in );
decoder_Destroy( p_image->p_dec );
}
if( p_image->p_enc )
vlc_encoder_Destroy( p_image->p_enc );
if( p_image->p_converter ) DeleteConverter( p_image->p_converter );
Expand Down

0 comments on commit a23ccf2

Please sign in to comment.