From 71aa477291c4c7437ba1418e363f0efe11e7a0de Mon Sep 17 00:00:00 2001 From: pancake Date: Thu, 7 Aug 2014 03:50:39 +0200 Subject: [PATCH] Fix another issues in json/query for Sdb --- shlr/sdb/src/json.c | 2 +- shlr/sdb/src/query.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shlr/sdb/src/json.c b/shlr/sdb/src/json.c index 76374fe66e..f2f4640b80 100644 --- a/shlr/sdb/src/json.c +++ b/shlr/sdb/src/json.c @@ -89,7 +89,7 @@ SDB_API int sdb_json_set (Sdb *s, const char *k, const char *p, const char *v, u ut32 c; char *js = sdb_get (s, k, &c); if (!js) { - char *b = malloc (strlen (k)+strlen (v)+8); + char *b = malloc (strlen (p)+strlen (v)+8); if (b) { int is_str = isstring (v); const char *q = is_str?"\"":""; diff --git a/shlr/sdb/src/query.c b/shlr/sdb/src/query.c index 95b9ff8aa4..417029c4ae 100644 --- a/shlr/sdb/src/query.c +++ b/shlr/sdb/src/query.c @@ -92,7 +92,7 @@ static int foreach_list_cb(void *user, const char *k, const char *v) { vlen = strlen (v); if (root) { rlen = strlen (root); - line = malloc (klen + vlen + rlen + 2); + line = malloc (klen + vlen + rlen + 3); memcpy (line, root, rlen); line[rlen]='/'; /*append the '/' at the end of the namespace */ memcpy (line+rlen+1, k, klen);