Skip to content
Permalink
Browse files
Fix MDEV-12631 valgrind warning for zipped tables
  modified:   storage/connect/filamzip.cpp
  • Loading branch information
Buggynours committed Apr 29, 2017
1 parent a091314 commit 63b7d9d
Showing 1 changed file with 10 additions and 4 deletions.
@@ -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

0 comments on commit 63b7d9d

Please sign in to comment.