[Scummvm-git-logs] scummvm master -> c280dd56c5e21e9fdab77e3d93ea1fe8ab68543b

Strangerke noreply at scummvm.org
Wed May 21 05:21:05 UTC 2025


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

Summary:
c280dd56c5 AWE: Fix another PVStudio warning in resource_3do


Commit: c280dd56c5e21e9fdab77e3d93ea1fe8ab68543b
    https://github.com/scummvm/scummvm/commit/c280dd56c5e21e9fdab77e3d93ea1fe8ab68543b
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-05-21T06:20:58+01:00

Commit Message:
AWE: Fix another PVStudio warning in resource_3do

Changed paths:
    engines/awe/resource_3do.cpp


diff --git a/engines/awe/resource_3do.cpp b/engines/awe/resource_3do.cpp
index 1bdfca20c24..e5420c421c4 100644
--- a/engines/awe/resource_3do.cpp
+++ b/engines/awe/resource_3do.cpp
@@ -137,8 +137,7 @@ uint8 *Resource3do::loadFile(int num, uint8 *dst, uint32 *size) {
 		if (!dst) {
 			dst = (uint8 *)malloc(sz);
 			if (!dst) {
-				warning("Unable to allocate %d bytes", sz);
-				return nullptr;
+				error("loadFile - Unable to allocate %d bytes", sz);
 			}
 		}
 		*size = sz;
@@ -148,16 +147,16 @@ uint8 *Resource3do::loadFile(int num, uint8 *dst, uint32 *size) {
 		return nullptr;
 	}
 
-	if (dst && memcmp(dst, "\x00\xf4\x01\x00", 4) == 0) {
+	if (memcmp(dst, "\x00\xf4\x01\x00", 4) == 0) {
 		static const int SZ = 64000 * 2;
 		uint8 *tmp = (uint8 *)calloc(1, SZ);
 		if (!tmp) {
-			warning("Unable to allocate %d bytes", SZ);
-			if (in != dst) free(dst);
-			return nullptr;
+			error("loadFile - Unable to allocate %d bytes", SZ);
 		}
 		const int decodedSize = decodeLzss(dst + 4, *size - 4, tmp);
-		if (in != dst) free(dst);
+		if (in != dst)
+			free(dst);
+
 		if (decodedSize != SZ) {
 			warning("Unexpected LZSS decoded size %d", decodedSize);
 			return nullptr;




More information about the Scummvm-git-logs mailing list