summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2015-01-23 21:54:29 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2015-01-23 21:54:29 +0100
commit2cd36ad7d0b538d632f774937cdb8269772ef0d7 (patch)
treebf41385ca75339802719cea74497b9cb9bb7c2a4
parentdc091a29352bf034ce699395f26a939020c9422e (diff)
downloadmariadb-git-2cd36ad7d0b538d632f774937cdb8269772ef0d7.tar.gz
- This to fix MDEV-7498. All changes made to AllocateValue to be sure that
the sp and p variable be initialised failed. Not understanding what causes this valgrind warning, I finally changed the way Mulval is allocated just to avoid it. This is a BAD solution as it does not really fix the problem but just hide it. This will have to be re-considered. modified: storage/connect/tabjson.cpp storage/connect/value.cpp
-rw-r--r--storage/connect/tabjson.cpp11
-rw-r--r--storage/connect/value.cpp12
2 files changed, 14 insertions, 9 deletions
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index ce731971e33..78bb47c45a3 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -507,7 +507,15 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
if (Parsed)
return false; // Already done
- else if (InitValue(g))
+
+ if (InitValue(g))
+ return true;
+ else
+ MulVal = Value;
+
+ Value = NULL;
+
+ if (InitValue(g))
return true;
else if (!Jpath)
Jpath = Name;
@@ -540,7 +548,6 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
} // endfor i, p
- MulVal = AllocateValue(g, Value);
Parsed = true;
return false;
} // end of ParseJpath
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index e80c31a2baa..32a4959df06 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -436,6 +436,9 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
bool un = (uns < 0) ? false : (uns > 0) ? true : valp->IsUnsigned();
PVAL vp;
+ if (!valp)
+ return NULL;
+
if (newtype == TYPE_VOID) // Means allocate a value of the same type
newtype = valp->GetType();
@@ -443,13 +446,8 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
case TYPE_STRING:
p = (PSZ)PlugSubAlloc(g, NULL, 1 + valp->GetValLen());
- if ((sp = valp->GetCharString(p)) != p) {
- if (sp)
- strcpy (p, sp);
- else
- *p = 0;
-
- } // endif sp
+ if ((sp = valp->GetCharString(p)) != p)
+ strcpy(p, sp);
vp = new(g) TYPVAL<PSZ>(g, p, valp->GetValLen(), valp->GetValPrec());
break;