database: fix regression bug
authorJosé Bollo <jose.bollo@iot.bzh>
Wed, 25 Oct 2017 09:17:15 +0000 (11:17 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Wed, 25 Oct 2017 09:17:15 +0000 (11:17 +0200)
Change-Id: I01722b00fc47e9b09c15e5123b8b0ef1a089c62e
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
ll-database-binding/src/ll-database-binding.c

index bd6a2a0..924bb89 100644 (file)
@@ -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;