projects
/
project
/
libubox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c725f9f
)
blobmsg_json: fix a memleak on error
author
Felix Fietkau
<nbd@openwrt.org>
Sat, 12 Apr 2014 18:23:23 +0000
(20:23 +0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Sat, 12 Apr 2014 18:23:23 +0000
(20:23 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
blobmsg_json.c
patch
|
blob
|
history
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);
else
blobmsg_format_element(&s, attr, false, false);
- if (!s.len)
+ if (!s.len) {
+ free(s.buf);
return NULL;
return NULL;
+ }
s.buf = realloc(s.buf, s.pos + 1);
s.buf[s.pos] = 0;
s.buf = realloc(s.buf, s.pos + 1);
s.buf[s.pos] = 0;