[Scummvm-git-logs] scummvm master -> 3efbcfa09aa40c9a49dee1746e0c79d5cfc167bc
mduggan
mgithub at guarana.org
Thu Apr 9 04:28:22 UTC 2020
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:
3efbcfa09a ULTIMA: Fix some memory management errors identified by clang
Commit: 3efbcfa09aa40c9a49dee1746e0c79d5cfc167bc
https://github.com/scummvm/scummvm/commit/3efbcfa09aa40c9a49dee1746e0c79d5cfc167bc
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-04-09T13:24:02+09:00
Commit Message:
ULTIMA: Fix some memory management errors identified by clang
Changed paths:
engines/ultima/nuvie/files/u6_lzw.cpp
engines/ultima/nuvie/screen/screen.cpp
engines/ultima/nuvie/sound/adplug/mid.cpp
diff --git a/engines/ultima/nuvie/files/u6_lzw.cpp b/engines/ultima/nuvie/files/u6_lzw.cpp
index 5d05b2d6fd..10d02dc4bf 100644
--- a/engines/ultima/nuvie/files/u6_lzw.cpp
+++ b/engines/ultima/nuvie/files/u6_lzw.cpp
@@ -284,7 +284,7 @@ unsigned char *U6Lzw::decompress_file(Std::string filename, uint32 &destination_
// destination_buffer_size = this->get_uncompressed_file_size(input_file);
// create the buffers
- source_buffer = (unsigned char *)malloc(sizeof(unsigned char *) * source_buffer_size);
+ source_buffer = (unsigned char *)malloc(sizeof(unsigned char) * source_buffer_size);
// destination_buffer = (unsigned char *)malloc(sizeof(unsigned char *) * destination_buffer_size);
// read the input file into the source buffer
diff --git a/engines/ultima/nuvie/screen/screen.cpp b/engines/ultima/nuvie/screen/screen.cpp
index b19ffeb141..17474dc8a4 100644
--- a/engines/ultima/nuvie/screen/screen.cpp
+++ b/engines/ultima/nuvie/screen/screen.cpp
@@ -861,7 +861,7 @@ void Screen::clearalphamap8(uint16 x, uint16 y, uint16 w, uint16 h, uint8 opacit
shading_rect.setWidth((w + (SHADING_BORDER * 2)) * 16 + 8);
shading_rect.setHeight((h + (SHADING_BORDER * 2)) * 16 + 8);
}
- shading_data = (byte *)malloc(sizeof(char) * shading_rect.width() * shading_rect.height());
+ shading_data = (byte *)malloc(sizeof(byte) * shading_rect.width() * shading_rect.height());
if (shading_data == NULL) {
/* We couldn't allocate memory for the opacity map, so just disable lighting */
shading_ambient = 0xFF;
diff --git a/engines/ultima/nuvie/sound/adplug/mid.cpp b/engines/ultima/nuvie/sound/adplug/mid.cpp
index a5d29f6c97..d959a72ac5 100644
--- a/engines/ultima/nuvie/sound/adplug/mid.cpp
+++ b/engines/ultima/nuvie/sound/adplug/mid.cpp
@@ -151,7 +151,7 @@ bool CmidPlayer::load(Std::string &filename, int song_index) {
if (good != 0)
subsongs = 1;
else {
- delete data;
+ delete [] data;
data = NULL;
return false;
}
More information about the Scummvm-git-logs
mailing list