changeset 398:ec2408d48b85 src

in dvdnav_describe_chapters() ifo could be leaked in case of erros; fixed by Erik Hovland
author nicodvb
date Wed, 22 Apr 2009 07:40:57 +0000
parents a70f79850e5f
children 61edd6fa781b
files searching.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/searching.c	Mon Feb 02 22:55:58 2009 +0000
+++ b/searching.c	Wed Apr 22 07:40:57 2009 +0000
@@ -551,7 +551,7 @@
   uint16_t parts, i;
   title_info_t *ptitle = NULL;
   ptt_info_t *ptt = NULL;
-  ifo_handle_t *ifo;
+  ifo_handle_t *ifo = NULL;
   pgc_t *pgc;
   cell_playback_t *cell;
   uint64_t length, *tmp=NULL;
@@ -571,6 +571,7 @@
   ifo = vm_get_title_ifo(this->vm, title);
   if(!ifo || !ifo->vts_pgcit) {
     printerr("Couldn't open IFO for chosen title, exit.");
+    retval = 0;
     goto fail;
   }
 
@@ -611,11 +612,14 @@
   }
   *duration = length;
   vm_ifo_close(ifo);
+  ifo = NULL;
   retval = parts;
   *times = tmp;
 
 fail:
   pthread_mutex_unlock(&this->vm_lock);
+  if(!retval && ifo)
+    vm_ifo_close(ifo);
   if(!retval && tmp)
     free(tmp);
   return retval;