From: divverent Date: Sun, 1 Apr 2012 13:30:16 +0000 (+0000) Subject: fix NULL dereference in jam and avw video playback when out of memory X-Git-Tag: xonotic-v0.8.0~96^2~260 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=74f809fd8f84b602076fed464a114da2011a6f72;p=xonotic%2Fdarkplaces.git 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 --- 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);