[Scummvm-cvs-logs] scummvm master -> 4ac19d8870d4c154f10f3e4288986b387a08fd41

eriktorbjorn eriktorbjorn at telia.com
Wed Dec 28 00:16:39 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4ac19d8870 VIDEO: Fix cppcheck warnings about possible NULL pointer use.


Commit: 4ac19d8870d4c154f10f3e4288986b387a08fd41
    https://github.com/scummvm/scummvm/commit/4ac19d8870d4c154f10f3e4288986b387a08fd41
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2011-12-27T15:15:50-08:00

Commit Message:
VIDEO: Fix cppcheck warnings about possible NULL pointer use.

Changed paths:
    video/dxa_decoder.cpp



diff --git a/video/dxa_decoder.cpp b/video/dxa_decoder.cpp
index 561719a..ca62228 100644
--- a/video/dxa_decoder.cpp
+++ b/video/dxa_decoder.cpp
@@ -115,9 +115,9 @@ bool DXADecoder::loadStream(Common::SeekableReadStream *stream) {
 	_scaledBuffer = 0;
 	if (_scaleMode != S_NONE) {
 		_scaledBuffer = (uint8 *)malloc(_frameSize);
-		memset(_scaledBuffer, 0, _frameSize);
 		if (!_scaledBuffer)
 			error("Error allocating scale buffer (size %u)", _frameSize);
+		memset(_scaledBuffer, 0, _frameSize);
 	}
 
 #ifdef DXA_EXPERIMENT_MAXD
@@ -489,9 +489,9 @@ const Graphics::Surface *DXADecoder::decodeNextFrame() {
 		if ((_inBuffer == NULL) || (_inBufferSize < size)) {
 			free(_inBuffer);
 			_inBuffer = (byte *)malloc(size);
-			memset(_inBuffer, 0, size);
 			if (_inBuffer == NULL)
 				error("Error allocating input buffer (size %u)", size);
+			memset(_inBuffer, 0, size);
 			_inBufferSize = size;
 		}
 






More information about the Scummvm-git-logs mailing list