diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2017-04-29 19:20:51 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2017-04-29 19:20:51 +0200 |
commit | 63b7d9d1586336a61d6de7fbdcdfbc72e6117f93 (patch) | |
tree | 9315e17e52ccac3a712542a3aa642303e6f9a47a /storage | |
parent | a091314d2775e0d33f2476953a7c5ab9647b2f37 (diff) | |
download | mariadb-git-63b7d9d1586336a61d6de7fbdcdfbc72e6117f93.tar.gz |
Fix MDEV-12631 valgrind warning for zipped tables
modified: storage/connect/filamzip.cpp
Diffstat (limited to 'storage')
-rw-r--r-- | storage/connect/filamzip.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp index 1a27c974f30..66e628abb14 100644 --- a/storage/connect/filamzip.cpp +++ b/storage/connect/filamzip.cpp @@ -1,7 +1,7 @@ /*********** File AM Zip C++ Program Source Code File (.CPP) ***********/ /* PROGRAM NAME: FILAMZIP */ /* ------------- */ -/* Version 1.1 */ +/* Version 1.2 */ /* */ /* COPYRIGHT: */ /* ---------- */ @@ -652,12 +652,18 @@ bool UNZIPUTL::openEntry(PGLOBAL g) } // endif rc size = finfo.uncompressed_size; - memory = new char[size + 1]; + + try { + memory = new char[size + 1]; + } catch (...) { + strcpy(g->Message, "Out of memory"); + return true; + } // end try/catch if ((rc = unzReadCurrentFile(zipfile, memory, size)) < 0) { sprintf(g->Message, "unzReadCurrentFile rc = %d", rc); unzCloseCurrentFile(zipfile); - free(memory); + delete[] memory; memory = NULL; entryopen = false; } else { @@ -682,7 +688,7 @@ void UNZIPUTL::closeEntry() } // endif entryopen if (memory) { - free(memory); + delete[] memory; memory = NULL; } // endif memory |