aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-10-25 11:17:15 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-10-25 11:17:15 +0200
commit8fde31a4e6760e6ef5cee75c736898901015184f (patch)
treed0825f8c8e4a036cd358c516026a3cee05341c93
parentb18e88a7e419feb6ef6dab7df2ecf4d3c181b61b (diff)
database: fix regression bug
Change-Id: I01722b00fc47e9b09c15e5123b8b0ef1a089c62e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--ll-database-binding/src/ll-database-binding.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ll-database-binding/src/ll-database-binding.c b/ll-database-binding/src/ll-database-binding.c
index bd6a2a0..924bb89 100644
--- a/ll-database-binding/src/ll-database-binding.c
+++ b/ll-database-binding/src/ll-database-binding.c
@@ -176,6 +176,7 @@ static int get_key(struct afb_req req, DBT *key)
memcpy(&data[lappid + 1], jkey, ljkey + 1);
/* return the key */
+ memset(key, 0, sizeof *key);
key->data = data;
key->size = (uint32_t)size;
return 0;
@@ -212,6 +213,7 @@ static void put(struct afb_req req, int replace)
AFB_INFO("put: key=%s, value=%s", (char*)key.data, value);
+ memset(&data, 0, sizeof data);
data.data = (void*)value;
data.size = (uint32_t)strlen(value) + 1; /* includes the tailing null */
@@ -271,6 +273,7 @@ static void verb_read(struct afb_req req)
AFB_INFO("read: key=%s", (char*)key.data);
+ memset(&data, 0, sizeof data);
data.data = value;
data.ulen = 4096;
data.flags = DB_DBT_USERMEM;