summaryrefslogtreecommitdiffstats
path: root/stream/tv.c
diff options
context:
space:
mode:
authorvoroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-01-08 05:55:46 +0000
committervoroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-01-08 05:55:46 +0000
commit3f102a3f59ccb0e98b53fcc29ac38c3dd0d16b89 (patch)
treeff3bc56514076c8ac4b038ed203f521dcf639160 /stream/tv.c
parent981c6999eaef04fdd92c5965c42755e082856ed4 (diff)
downloadmpv-3f102a3f59ccb0e98b53fcc29ac38c3dd0d16b89.tar.bz2
mpv-3f102a3f59ccb0e98b53fcc29ac38c3dd0d16b89.tar.xz
Two crash issues fixed:
1. Freeing of unallocated memory when tv driver fails to initialize itself. 2. Call to tv driver's tv_uninit more than once. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21855 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream/tv.c')
-rw-r--r--stream/tv.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/stream/tv.c b/stream/tv.c
index 2a95db7b76..44d16a42fe 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -480,6 +480,7 @@ static demuxer_t* demux_open_tv(demuxer_t *demuxer)
sh_audio_t *sh_audio = NULL;
tvi_functions_t *funcs;
+ demuxer->priv=NULL;
if(!(tvh=tv_begin())) return NULL;
if (!tv_init(tvh)) return NULL;
if (!open_tv(tvh)){
@@ -625,7 +626,9 @@ no_audio:
static void demux_close_tv(demuxer_t *demuxer)
{
tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->priv);
+ if (!tvh) return;
tvh->functions->uninit(tvh->priv);
+ demuxer->priv=NULL;
}
/* ================== STREAM_TV ===================== */
@@ -668,7 +671,12 @@ int tv_init(tvi_handle_t *tvh)
int tv_uninit(tvi_handle_t *tvh)
{
- return(tvh->functions->uninit(tvh->priv));
+ int res;
+ if(!tvh) return 1;
+ if (!tvh->priv) return 1;
+ res=tvh->functions->uninit(tvh->priv);
+ if(res) tvh->priv=NULL;
+ return res;
}
/* utilities for mplayer (not mencoder!!) */