summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <knielsen@ymer.(none)>2006-10-25 10:46:00 +0200
committerunknown <knielsen@ymer.(none)>2006-10-25 10:46:00 +0200
commite3563c4e22f04cdfe2b2a0a34fb96417b1a8fccc (patch)
tree0fbcc2dd3c237a731a6454782096a41c2b0ff5af /ndb
parent2bb8cb183ced059899b9c3d065b1f9fff80fcb92 (diff)
parentc6ca641a6ba8b7edbc9f08de8dc46356b50028a6 (diff)
downloadmariadb-git-e3563c4e22f04cdfe2b2a0a34fb96417b1a8fccc.tar.gz
Merge ymer.(none):/usr/local/mysql/mysql-4.1-ndb.tmp
into ymer.(none):/usr/local/mysql/mysql-4.1-ndb
Diffstat (limited to 'ndb')
-rw-r--r--ndb/include/util/UtilBuffer.hpp8
-rw-r--r--ndb/src/common/util/SimpleProperties.cpp4
2 files changed, 8 insertions, 4 deletions
diff --git a/ndb/include/util/UtilBuffer.hpp b/ndb/include/util/UtilBuffer.hpp
index f43fc960a16..ba1f47b93d8 100644
--- a/ndb/include/util/UtilBuffer.hpp
+++ b/ndb/include/util/UtilBuffer.hpp
@@ -73,11 +73,15 @@ public:
}
int assign(const void * d, size_t l) {
- if (data) free(data);
+ /* Free the old data only after copying, in case d==data. */
+ void *old_data= data;
data = NULL;
len = 0;
alloc_size = 0;
- return append(d, l);
+ int ret= append(d, l);
+ if (old_data)
+ free(old_data);
+ return ret;
}
void clear() {
diff --git a/ndb/src/common/util/SimpleProperties.cpp b/ndb/src/common/util/SimpleProperties.cpp
index 00c440fcb4e..1dbce41aadb 100644
--- a/ndb/src/common/util/SimpleProperties.cpp
+++ b/ndb/src/common/util/SimpleProperties.cpp
@@ -245,7 +245,7 @@ SimpleProperties::pack(Writer & it, const void * __src,
const char * src_len = _src + _map[i].Length_Offset;
Uint32 len = *((Uint32*)src_len);
if(!ignoreMinMax){
- if(len == _map[i].maxValue)
+ if(len > _map[i].maxValue)
return ValueTooHigh;
}
ok = it.add(_map[i].Key, src, len);
@@ -254,7 +254,7 @@ SimpleProperties::pack(Writer & it, const void * __src,
case SimpleProperties::StringValue:
if(!ignoreMinMax){
size_t len = strlen(src);
- if(len == _map[i].maxValue)
+ if(len > _map[i].maxValue)
return ValueTooHigh;
}
ok = it.add(_map[i].Key, src);