Commit 63b7d9d1 authored by Olivier Bertrand's avatar Olivier Bertrand

Fix MDEV-12631 valgrind warning for zipped tables

  modified:   storage/connect/filamzip.cpp
parent a091314d
/*********** 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment