projects
/
project
/
libubox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
blobmsg_json: fix a memleak on error
[project/libubox.git]
/
blobmsg_json.c
diff --git
a/blobmsg_json.c
b/blobmsg_json.c
index
c84fd93
..
3b32b93
100644
(file)
--- a/
blobmsg_json.c
+++ b/
blobmsg_json.c
@@
-304,8
+304,10
@@
char *blobmsg_format_json_with_cb(struct blob_attr *attr, bool list, blobmsg_jso
else
blobmsg_format_element(&s, attr, false, false);
- if (!s.len)
+ if (!s.len) {
+ free(s.buf);
return NULL;
+ }
s.buf = realloc(s.buf, s.pos + 1);
s.buf[s.pos] = 0;