X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ffile.cpp;fp=src%2Ffile.cpp;h=8c1a7038842a56e2cfa34b707fe075b76018ec34;hb=68e8886a9aaf48fcc130334d8cf4fe35a4534a02;hp=6e895c57611887c34cb3cf557b64f516d7de70b2;hpb=b79146c85ed8f85acc80fe56534f72cd777f0b02;p=virtualjaguar diff --git a/src/file.cpp b/src/file.cpp index 6e895c5..8c1a703 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -361,7 +361,7 @@ static bool CheckExtension(const char * filename, const char * ext) // Get file from .ZIP // Returns the size of the file inside the .ZIP file that we're looking at // -uint32 GetFileFromZIP(const char * zipFile, FileType type, uint8 * buffer) +uint32 GetFileFromZIP(const char * zipFile, FileType type, uint8 * &buffer) { #warning "!!! FIX !!! Should have sanity checking for ROM size to prevent buffer overflow!" const char ftStrings[5][32] = { "Software", "EEPROM", "Label", "Box Art", "Controller Overlay" }; @@ -399,6 +399,7 @@ uint32 GetFileFromZIP(const char * zipFile, FileType type, uint8 * buffer) if (found) { WriteLog("FILE: Uncompressing..."); + buffer = new uint8[ze->uncompressed_size]; if (readuncompresszip(zip, ze, (char *)buffer) == 0) { @@ -408,6 +409,7 @@ uint32 GetFileFromZIP(const char * zipFile, FileType type, uint8 * buffer) else { WriteLog("FAILED!\n"); + delete[] buffer; return 0; } }