7z: copy/paste error in error checking, found by static analysis.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 17 May 2020 01:26:31 -0400
changeset 1689 1dc6e265fefc
parent 1687 121ff17a612d
child 1691 c66c9326b05d
7z: copy/paste error in error checking, found by static analysis. This was clearly copied from a previous line but wasn't updated with the correct condition to check, so if malloc() failed, it would dereference NULL instead of reporting an error.
src/physfs_archiver_7z.c
--- a/src/physfs_archiver_7z.c	Sat May 16 23:30:16 2020 -0400
+++ b/src/physfs_archiver_7z.c	Sun May 17 01:26:31 2020 -0400
@@ -290,7 +290,7 @@
     io = NULL;
 
     buf = allocator.Malloc(outSizeProcessed);
-    GOTO_IF(rc != SZ_OK, PHYSFS_ERR_OUT_OF_MEMORY, SZIP_openRead_failed);
+    GOTO_IF(buf == NULL, PHYSFS_ERR_OUT_OF_MEMORY, SZIP_openRead_failed);
     memcpy(buf, outBuffer + offset, outSizeProcessed);
 
     alloc->Free(alloc, outBuffer);