projects
/
platform
/
core
/
system
/
sensord.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
sensord: allocate buf memory for string attribute
[platform/core/system/sensord.git]
/
src
/
client
/
sensor_listener.cpp
diff --git
a/src/client/sensor_listener.cpp
b/src/client/sensor_listener.cpp
index
7c62ea1
..
b8db2a2
100644
(file)
--- a/
src/client/sensor_listener.cpp
+++ b/
src/client/sensor_listener.cpp
@@
-392,6
+392,10
@@
int sensor_listener::set_attribute(int attribute, const char *value, int len)
msg.set_type(CMD_LISTENER_ATTR_STR);
buf.listener_id = m_id;
buf.attribute = attribute;
+
+ buf.value = new(std::nothrow) char[len];
+ retvm_if(!buf.value, -ENOMEM, "Failed to allocate memory");
+
memcpy(buf.value, value, len);
buf.len = len;