Skip to content

Commit 2f9db4e

Browse files
committed
Fix MDEV-12631 valgrind warning for zipped tables
modified: storage/connect/filamzip.cpp Add to STRING a member for testing OOM condition modified: storage/connect/xtable.h Work on MONGO type and add some of its features to JSON MGO tables modified: storage/connect/filter.cpp modified: storage/connect/filter.h modified: storage/connect/ha_connect.cc modified: storage/connect/mongofam.cpp modified: storage/connect/mongofam.h modified: storage/connect/tabjson.cpp modified: storage/connect/tabjson.h modified: storage/connect/tabmgo.cpp modified: storage/connect/tabmgo.h
1 parent b6135bb commit 2f9db4e

File tree

12 files changed

+443
-483
lines changed

12 files changed

+443
-483
lines changed

storage/connect/CMakeLists - Copie.txt

Lines changed: 0 additions & 345 deletions
This file was deleted.

storage/connect/filamzip.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*********** File AM Zip C++ Program Source Code File (.CPP) ***********/
22
/* PROGRAM NAME: FILAMZIP */
33
/* ------------- */
4-
/* Version 1.1 */
4+
/* Version 1.2 */
55
/* */
66
/* COPYRIGHT: */
77
/* ---------- */
@@ -652,12 +652,18 @@ bool UNZIPUTL::openEntry(PGLOBAL g)
652652
} // endif rc
653653

654654
size = finfo.uncompressed_size;
655-
memory = new char[size + 1];
655+
656+
try {
657+
memory = new char[size + 1];
658+
} catch (...) {
659+
strcpy(g->Message, "Out of memory");
660+
return true;
661+
} // end try/catch
656662

657663
if ((rc = unzReadCurrentFile(zipfile, memory, size)) < 0) {
658664
sprintf(g->Message, "unzReadCurrentFile rc = %d", rc);
659665
unzCloseCurrentFile(zipfile);
660-
free(memory);
666+
delete[] memory;
661667
memory = NULL;
662668
entryopen = false;
663669
} else {
@@ -682,7 +688,7 @@ void UNZIPUTL::closeEntry()
682688
} // endif entryopen
683689

684690
if (memory) {
685-
free(memory);
691+
delete[] memory;
686692
memory = NULL;
687693
} // endif memory
688694

0 commit comments

Comments
 (0)