[libbluray-devel] [PATCH] Fixed memory leaks.

Ferdinand Holzer holzer at grg21.ac.at
Sun May 27 18:11:16 CEST 2012


Well, since there's a check at allocation time (against
ss->sa_num_primary_audio_ref, ss->sv_num_secondary_audio_ref and
ss->sv_num_pip_pg_ref)
I'd prefer to keep the check in some way, either a NULL check or against
*_num_*

What do you think?

On 05/27/2012 09:21 AM, John Stebbins wrote:
> Null test for sa_primary_audio_ref, sv_secondary_audio_ref, and
> sv_pip_pg_ref is unnecessary.  Remove these and this would look good
> to me.
>
> On 05/27/2012 02:17 AM, Ferdinand Holzer wrote:
>> audio_ref's weren't freed in _clean_stn.
>> bd handle wasn't closed in list_titles example.
>> ---
>>   src/examples/list_titles.c       |    1 +
>>   src/libbluray/bdnav/mpls_parse.c |   12 ++++++++++++
>>   2 files changed, 13 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/examples/list_titles.c b/src/examples/list_titles.c
>> index a987951..14679f7 100644
>> --- a/src/examples/list_titles.c
>> +++ b/src/examples/list_titles.c
>> @@ -96,5 +96,6 @@ int main(int argc, char *argv[])
>>           );
>>           bd_free_title_info(ti);
>>       }
>> +    bd_close(bd);
>>       return 0;
>>   }
>> diff --git a/src/libbluray/bdnav/mpls_parse.c
>> b/src/libbluray/bdnav/mpls_parse.c
>> index 5c83532..166efef 100644
>> --- a/src/libbluray/bdnav/mpls_parse.c
>> +++ b/src/libbluray/bdnav/mpls_parse.c
>> @@ -401,6 +401,18 @@ _parse_stn(BITSTREAM *bits, MPLS_STN *stn)
>>   static void
>>   _clean_stn(MPLS_STN *stn)
>>   {
>> +    if(stn->secondary_audio&& 
>> stn->secondary_audio->sa_primary_audio_ref) {
>> +        X_FREE(stn->secondary_audio->sa_primary_audio_ref);
>> +    }
>> +    if(stn->secondary_video) {
>> +        if(stn->secondary_video->sv_secondary_audio_ref) {
>> +            X_FREE(stn->secondary_video->sv_secondary_audio_ref);
>> +        }
>> +        if(stn->secondary_video->sv_pip_pg_ref) {
>> +            X_FREE(stn->secondary_video->sv_pip_pg_ref);
>> +        }
>> +    }
>> +
>>       X_FREE(stn->video);
>>       X_FREE(stn->audio);
>>       X_FREE(stn->pg);
> _______________________________________________
> libbluray-devel mailing list
> libbluray-devel at videolan.org
> http://mailman.videolan.org/listinfo/libbluray-devel



More information about the libbluray-devel mailing list