libjson's json_object_from_file takes a non-const char buffer as its second parameter while libjson-c takes a const one. Use strdup() to avoid using const data as non-const.
Signed-off-by: Dmitri Bachtin <[email protected]> --- blobmsg_json.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/blobmsg_json.c b/blobmsg_json.c index ffde23d..de876cf 100644 --- a/blobmsg_json.c +++ b/blobmsg_json.c @@ -97,7 +97,10 @@ out: bool blobmsg_add_json_from_file(struct blob_buf *b, const char *file) { - return __blobmsg_add_json(b, json_object_from_file(file)); + char* __file = strdup(file); + bool result = __blobmsg_add_json(b, json_object_from_file(__file)); + free(__file); + return result; } bool blobmsg_add_json_from_string(struct blob_buf *b, const char *str) -- 1.7.2.5 _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
