From dfb24955230b89f204e8ab00f318ff2b0e961db3 Mon Sep 17 00:00:00 2001 From: divverent Date: Sun, 1 Apr 2012 13:30:16 +0000 Subject: [PATCH] fix NULL dereference in jam and avw video playback when out of memory git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11778 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=74f809fd8f84b602076fed464a114da2011a6f72 --- cl_video_jamdecode.c | 4 ++-- cl_video_libavw.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cl_video_jamdecode.c b/cl_video_jamdecode.c index 475f1f7b..04bd6348 100644 --- a/cl_video_jamdecode.c +++ b/cl_video_jamdecode.c @@ -53,12 +53,12 @@ void *jam_open(clvideo_t *video, char *filename, const char **errorstring) // allocate stream structure s = (jamdecodestream_t *)Z_Malloc(sizeof(jamdecodestream_t)); memset(s, 0, sizeof(jamdecodestream_t)); - s->sndchan = -1; if (s == NULL) { *errorstring = "unable to allocate memory for stream info structure"; return NULL; } + s->sndchan = -1; // open file s->file = FS_OpenVirtualFile(filename, true); @@ -375,4 +375,4 @@ readframe: #endif } return 0; -} \ No newline at end of file +} diff --git a/cl_video_libavw.c b/cl_video_libavw.c index 206b9c69..7924127a 100644 --- a/cl_video_libavw.c +++ b/cl_video_libavw.c @@ -260,13 +260,13 @@ static void *LibAvW_OpenVideo(clvideo_t *video, char *filename, const char **err // allocate stream s = (libavwstream_t *)Z_Malloc(sizeof(libavwstream_t)); - s->sndchan = -1; - memset(s, 0, sizeof(libavwstream_t)); if (s == NULL) { *errorstring = "unable to allocate memory for stream info structure"; return NULL; } + memset(s, 0, sizeof(libavwstream_t)); + s->sndchan = -1; // open file s->file = FS_OpenVirtualFile(filename, true); -- 2.39.2