diff options
author | Colin Snover | 2016-06-14 20:26:32 -0500 |
---|---|---|
committer | Colin Snover | 2016-06-14 20:58:53 -0500 |
commit | ffcab2fa5dfea99601cd214a08cdce0a0f0d5301 (patch) | |
tree | 2c65a50fec5a2345dbe25b766a5ebab69ed99b40 | |
parent | b56266d28dad338243dd0982328fed7f48633e84 (diff) | |
download | scummvm-rg350-ffcab2fa5dfea99601cd214a08cdce0a0f0d5301.tar.gz scummvm-rg350-ffcab2fa5dfea99601cd214a08cdce0a0f0d5301.tar.bz2 scummvm-rg350-ffcab2fa5dfea99601cd214a08cdce0a0f0d5301.zip |
SCI: Fix memory leaks in resource patcher
-rw-r--r-- | engines/sci/resource.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 6a5af1a6d6..9f977aaefd 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -1352,6 +1352,7 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource Common::File *file = new Common::File(); if (!file->open(source->getLocationName())) { warning("ResourceManager::processPatch(): failed to open %s", source->getLocationName().c_str()); + delete source; return; } fileStream = file; @@ -1360,6 +1361,7 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource int fsize = fileStream->size(); if (fsize < 3) { debug("Patching %s failed - file too small", source->getLocationName().c_str()); + delete source; return; } @@ -1370,6 +1372,7 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource if (patchType != checkForType) { debug("Patching %s failed - resource type mismatch", source->getLocationName().c_str()); + delete source; return; } @@ -1394,6 +1397,7 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource if (patchDataOffset + 2 >= fsize) { debug("Patching %s failed - patch starting at offset %d can't be in file of size %d", source->getLocationName().c_str(), patchDataOffset + 2, fsize); + delete source; return; } |