summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <pekka@mysql.com>2005-06-13 16:19:20 +0200
committerunknown <pekka@mysql.com>2005-06-13 16:19:20 +0200
commita2c00c6b42c08def536d0867a5cc63f3b065b468 (patch)
tree77dff4a3e04593536634c250faf23fa6aa0e3d6b /ndb
parent8c4fe301d096dafb0954bb4a3acd65d392932417 (diff)
downloadmariadb-git-a2c00c6b42c08def536d0867a5cc63f3b065b468.tar.gz
ndb - valgrind fixes
ndb/src/ndbapi/NdbDictionaryImpl.cpp: valgrind fixes ndb/test/ndbapi/testBlobs.cpp: valgrind fixes
Diffstat (limited to 'ndb')
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp7
-rw-r--r--ndb/test/ndbapi/testBlobs.cpp5
2 files changed, 9 insertions, 3 deletions
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index 4523ae2c261..645aa333ea7 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -1004,6 +1004,11 @@ NdbDictInterface::getTable(const char * name, bool fullyQualifiedNames)
return 0;
}
+ // avoid alignment problem and memory overrun
+ Uint32 name_buf[(MAX_TAB_NAME_SIZE + 3) / 4];
+ strncpy((char*)name_buf, name, sizeof(name_buf)); // strncpy null-pads
+ name = (char*)name_buf;
+
req->senderRef = m_reference;
req->senderData = 0;
req->requestType =
@@ -1015,7 +1020,7 @@ NdbDictInterface::getTable(const char * name, bool fullyQualifiedNames)
tSignal.theLength = GetTabInfoReq::SignalLength;
LinearSectionPtr ptr[1];
ptr[0].p = (Uint32*)name;
- ptr[0].sz = strLen;
+ ptr[0].sz = (strLen + 3) / 4;
return getTable(&tSignal, ptr, 1, fullyQualifiedNames);
}
diff --git a/ndb/test/ndbapi/testBlobs.cpp b/ndb/test/ndbapi/testBlobs.cpp
index a4e7a53a5d1..efbdceac5a6 100644
--- a/ndb/test/ndbapi/testBlobs.cpp
+++ b/ndb/test/ndbapi/testBlobs.cpp
@@ -365,7 +365,7 @@ calcBval(const Bcol& b, Bval& v, bool keepsize)
{
if (b.m_nullable && urandom(10) == 0) {
v.m_len = 0;
- delete v.m_val;
+ delete [] v.m_val;
v.m_val = 0;
v.m_buf = new char [1];
} else {
@@ -375,7 +375,7 @@ calcBval(const Bcol& b, Bval& v, bool keepsize)
v.m_len = urandom(b.m_inline);
else
v.m_len = urandom(b.m_inline + g_opt.m_parts * b.m_partsize + 1);
- delete v.m_val;
+ delete [] v.m_val;
v.m_val = new char [v.m_len + 1];
for (unsigned i = 0; i < v.m_len; i++)
v.m_val[i] = 'a' + urandom(25);
@@ -1449,6 +1449,7 @@ testperf()
if (! testcase('p'))
return 0;
DBG("=== perf test ===");
+ g_bh1 = g_bh2 = 0;
g_ndb = new Ndb(g_ncc, "TEST_DB");
CHK(g_ndb->init() == 0);
CHK(g_ndb->waitUntilReady() == 0);