Commit ebbecd97 authored by Rémi Duraffort's avatar Rémi Duraffort Committed by Jean-Baptiste Kempf

invmem: fix potential memleaks.

parent 88acacee
...@@ -120,15 +120,16 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -120,15 +120,16 @@ static int OpenDecoder( vlc_object_t *p_this )
} }
/* Allocate the memory needed to store the decoder's structure */ /* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys = p_sys = if( ( p_dec->p_sys = p_sys = malloc(sizeof(decoder_sys_t)) ) == NULL )
(decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
return VLC_ENOMEM; return VLC_ENOMEM;
// get parametrs // get parametrs
p_sys->i_width = var_CreateGetInteger( p_this, "invmem-width" ); p_sys->i_width = var_CreateGetInteger( p_this, "invmem-width" );
p_sys->i_height = var_CreateGetInteger( p_this, "invmem-height" ); p_sys->i_height = var_CreateGetInteger( p_this, "invmem-height" );
if (p_sys->i_width == 0 || p_sys->i_height == 0) { if( p_sys->i_width == 0 || p_sys->i_height == 0 )
{
msg_Err( p_dec, "--vmem-width and --vmem-height must be > 0" ); msg_Err( p_dec, "--vmem-width and --vmem-height must be > 0" );
free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -147,6 +148,7 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -147,6 +148,7 @@ static int OpenDecoder( vlc_object_t *p_this )
if( !p_sys->pf_lock || !p_sys->pf_unlock ) if( !p_sys->pf_lock || !p_sys->pf_unlock )
{ {
msg_Err( p_dec, "Invalid lock or unlock callbacks" ); msg_Err( p_dec, "Invalid lock or unlock callbacks" );
free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
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