# HG changeset patch # User voroshil # Date 1168235746 0 # Node ID 922c0072a2bf959c54075599882845c907694023 # Parent 7c5e893dff54639817c2dbc3b118129c0e39acb3 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. diff -r 7c5e893dff54 -r 922c0072a2bf stream/tv.c --- a/stream/tv.c Sun Jan 07 19:23:59 2007 +0000 +++ b/stream/tv.c Mon Jan 08 05:55:46 2007 +0000 @@ -480,6 +480,7 @@ 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 @@ 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_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!!) */