[libbluray-devel] [PATCH 1/2] Fixed memory leak in mpls parsing.
Ferdinand Holzer
holzer at grg21.ac.at
Sun May 27 04:58:24 CEST 2012
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);
--
1.7.7
More information about the libbluray-devel
mailing list