From 28f03eec2826b61adc58e545a642d3d14163cf91 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 23 Mar 2007 21:47:31 +0000 Subject: Fix closing the vcd device if the disc is not a video CD. libvcdinfo 0.7.23 closes the device in this case whereas the built-in version did not, and this was causing double frees due to my previous fix which addressed only the built-in version (which needs to be either updated to 0.7.23 or dropped). CVS patchset: 8743 CVS date: 2007/03/23 21:47:31 --- src/input/vcd/libvcd/info.c | 16 +++++++--------- src/input/vcd/vcdio.c | 5 ++--- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/input/vcd/libvcd/info.c b/src/input/vcd/libvcd/info.c index d178968a8..b01bd6eee 100644 --- a/src/input/vcd/libvcd/info.c +++ b/src/input/vcd/libvcd/info.c @@ -1,5 +1,5 @@ /* - $Id: info.c,v 1.7 2006/09/26 22:29:39 dgp85 Exp $ + $Id: info.c,v 1.8 2007/03/23 21:47:31 dsalt Exp $ Copyright (C) 2002, 2003, 2004 Rocky Bernstein @@ -59,7 +59,7 @@ #include #include -static const char _rcsid[] = "$Id: info.c,v 1.7 2006/09/26 22:29:39 dgp85 Exp $"; +static const char _rcsid[] = "$Id: info.c,v 1.8 2007/03/23 21:47:31 dsalt Exp $"; #define BUF_COUNT 16 #define BUF_SIZE 80 @@ -1904,14 +1904,12 @@ vcdinfo_open(vcdinfo_obj_t **obj_p, char *source_name[], strlen (ISO_XA_MARKER_STRING)); } - if (!read_info(obj->img, &(obj->info), &(obj->vcd_type))) - return VCDINFO_OPEN_OTHER; - - if (vcdinfo_get_format_version (obj) == VCD_TYPE_INVALID) - return VCDINFO_OPEN_OTHER; - - if (!read_entries(obj->img, &(obj->entries))) + if (!read_info(obj->img, &(obj->info), &(obj->vcd_type)) || + vcdinfo_get_format_version (obj) == VCD_TYPE_INVALID || + !read_entries(obj->img, &(obj->entries))) { + free (obj); /* match 0.7.23's behaviour */ return VCDINFO_OPEN_OTHER; + } { size_t len = strlen(*source_name)+1; diff --git a/src/input/vcd/vcdio.c b/src/input/vcd/vcdio.c index 31cc0cd49..387397cf4 100644 --- a/src/input/vcd/vcdio.c +++ b/src/input/vcd/vcdio.c @@ -1,5 +1,5 @@ /* - $Id: vcdio.c,v 1.8 2006/12/13 19:14:19 dsalt Exp $ + $Id: vcdio.c,v 1.9 2007/03/23 21:47:31 dsalt Exp $ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein @@ -115,8 +115,7 @@ vcdio_open(vcdplayer_t *p_vcdplayer, char *intended_vcd_device) break; default: - /* Opened the device, but it's not a VCD => close it & return failure */ - vcdinfo_close(p_vcdplayer->vcd); + /* Opened the device, but it's not a VCD => is closed, return failure */ return false; } -- cgit v1.2.3