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

John Stebbins stebbins at jetheaddev.com
Sun May 27 09:21:17 CEST 2012


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);


More information about the libbluray-devel mailing list