[DVDnav-discuss] [PATCH] It is possible to leak an ifo handle in an error path in searching.c
Erik Hovland
erik at hovland.org
Sat Feb 14 01:04:31 CET 2009
If ifo is OK and ifo->vts_pgcit is not, then ifo could be leaked in the
error path.
Signed-off-by: Erik Hovland <erik at hovland.org>
---
src/searching.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/searching.c b/src/searching.c
index 4d354f3..aead0c3 100644
--- a/src/searching.c
+++ b/src/searching.c
@@ -551,7 +551,7 @@ uint32_t dvdnav_describe_title_chapters(dvdnav_t *this, int32_t title, uint64_t
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(dvdnav_t *this, int32_t title, uint64_t
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(dvdnav_t *this, int32_t title, uint64_t
}
*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