[DVDnav-discuss] r1169 - trunk/libdvdnav/src/searching.c

nicodvb subversion at mplayerhq.hu
Wed Apr 22 09:40:58 CEST 2009


Author: nicodvb
Date: Wed Apr 22 09:40:57 2009
New Revision: 1169

Log:
in dvdnav_describe_chapters() ifo could be leaked in case of erros; fixed by Erik Hovland

Modified:
   trunk/libdvdnav/src/searching.c

Modified: trunk/libdvdnav/src/searching.c
==============================================================================
--- trunk/libdvdnav/src/searching.c	Sun Feb 15 19:30:24 2009	(r1168)
+++ trunk/libdvdnav/src/searching.c	Wed Apr 22 09:40:57 2009	(r1169)
@@ -551,7 +551,7 @@ uint32_t dvdnav_describe_title_chapters(
   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 @@ uint32_t dvdnav_describe_title_chapters(
   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 @@ uint32_t dvdnav_describe_title_chapters(
   }
   *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;


More information about the DVDnav-discuss mailing list