summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2013-07-18 21:23:40 -0700
committerJay Sorg <jay.sorg@gmail.com>2013-07-18 21:23:40 -0700
commit4322a136f1d23585e6b95c9d38e1f56de4cb81d0 (patch)
tree7de979e9608d2091cced72861075c82ba92ab721
parentbf9419c527708ce20c72391a826eee6b696170ed (diff)
downloadxrdp-proprietary-4322a136f1d23585e6b95c9d38e1f56de4cb81d0.tar.gz
xrdp-proprietary-4322a136f1d23585e6b95c9d38e1f56de4cb81d0.zip
xrdpvr: fix a crash in xrdpvr_deinit_player
-rw-r--r--xrdpvr/xrdpvr.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/xrdpvr/xrdpvr.c b/xrdpvr/xrdpvr.c
index 6f39e975..89daccf8 100644
--- a/xrdpvr/xrdpvr.c
+++ b/xrdpvr/xrdpvr.c
@@ -92,11 +92,27 @@ xrdpvr_deinit_player(void *channel, int stream_id)
}
/* do local clean up */
- av_free(g_psi.frame);
- avcodec_close(g_psi.p_audio_codec_ctx);
- avcodec_close(g_psi.p_video_codec_ctx);
+ if (g_psi.frame != 0)
+ {
+ av_free(g_psi.frame);
+ g_psi.frame = 0;
+ }
+ if (g_psi.p_audio_codec_ctx != 0)
+ {
+ avcodec_close(g_psi.p_audio_codec_ctx);
+ g_psi.p_audio_codec_ctx = 0;
+ }
+ if (g_psi.p_video_codec_ctx != 0)
+ {
+ avcodec_close(g_psi.p_video_codec_ctx);
+ g_psi.p_video_codec_ctx = 0;
+ }
//avformat_close_input(&g_psi.p_format_ctx);
- av_close_input_file(g_psi.p_format_ctx);
+ if (g_psi.p_format_ctx != 0)
+ {
+ av_close_input_file(g_psi.p_format_ctx);
+ g_psi.p_format_ctx = 0;
+ }
/* do remote cleanup */