summaryrefslogtreecommitdiffstats
path: root/src/qlibwindowmanager.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-11-14 00:05:54 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-11-14 00:05:54 +0100
commit02f58b0b3f13b51395fc55d03afdbb445ba58b8d (patch)
treec321515a7d5caa1995d850dd24fb4ac19494db79 /src/qlibwindowmanager.cpp
parent77460e797c950f6a2c742cc8604a58b5deb86616 (diff)
Fix: free(): invalid next size (normal)
Wrong str allocation leads to crash binding ! Change-Id: I58f6e1c6585a97a7221a6a309bd2d98bf634f111 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/qlibwindowmanager.cpp')
-rw-r--r--src/qlibwindowmanager.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/qlibwindowmanager.cpp b/src/qlibwindowmanager.cpp
index b5fad2c..bc313e5 100644
--- a/src/qlibwindowmanager.cpp
+++ b/src/qlibwindowmanager.cpp
@@ -33,8 +33,7 @@ int QLibWindowmanager::init(int port, const QString &token) {
int QLibWindowmanager::requestSurface(const QString &label) {
string cstr = label.toStdString();
- applabel = new char[cstr.length() + 1];
- memcpy(applabel, cstr.c_str(), cstr.length() + 1);
+ applabel = strdup(cstr.c_str());
json_object *obj = json_object_new_object();
json_object_object_add(obj, wm->kKeyDrawingName, json_object_new_string(applabel));