gfto / dvblast

DVBlast is a simple and powerful MPEG-2/TS demux and streaming application. This repository is mirror of official repo at git://git.videolan.org/dvblast.git and my personal development tree.
http://www.videolan.org/projects/dvblast.html
GNU General Public License v2.0
88 stars 38 forks source link

ConditionalAccessClose do not freeing memory ... #18

Closed ghost closed 4 years ago

ghost commented 6 years ago

I have found a possible missing of "freeing memory" on "ConditionalAccessClose".

During call of "ConditionalAccessHandle" the function allocate memory for "system_ids" :

        p_ids->i_nb_system_ids = l / 2;
        p_ids->pi_system_ids = malloc( p_ids->i_nb_system_ids
                                        * sizeof(uint16_t) );

After removing the DVB-CI slot cam the prevoius allocate memory is not "freed".

    msg_Dbg( p_access, "closing ConditionalAccess session (%d)", i_session_id );
    free( p_sessions[i_session_id - 1].p_sys );

the memory allocated for system id is not released.

I guess the right code should be:

    system_ids_t *p_ids =
        (system_ids_t *)p_sessions[i_session_id - 1].p_sys;           

    if ( p_ids->i_nb_system_ids )
        free( p_ids->pi_system_ids );

    msg_Dbg( p_access, "closing ConditionalAccess session (%d)", i_session_id );

    free( p_sessions[i_session_id - 1].p_sys );

Am I right ?