X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fprocd.git;a=blobdiff_plain;f=hotplug-rule.c;h=1f3189d6f849dc521ffb09b36065f0fe56d9fce5;hp=b157fcd19bca926ec11a7215eaaa394afa3397b8;hb=1dc968d494c86e4a48335428b7c5cb99ca12e106;hpb=4d326e16578fa2992f3bb6ab21775d4db03558d4 diff --git a/hotplug-rule.c b/hotplug-rule.c index b157fcd..1f3189d 100644 --- a/hotplug-rule.c +++ b/hotplug-rule.c @@ -325,7 +325,7 @@ static void cmd_add_string(const char *pattern, struct blob_attr *msg) int len = 0; bool var = false; - blobmsg_alloc_string_buffer(&b, NULL, 1); + dest = blobmsg_alloc_string_buffer(&b, NULL, 1); str = alloca(strlen(pattern) + 1); strcpy(str, pattern); next = str; @@ -354,7 +354,7 @@ static void cmd_add_string(const char *pattern, struct blob_attr *msg) } if (cur_len) { - dest = blobmsg_realloc_string_buffer(&b, cur_len); + dest = blobmsg_realloc_string_buffer(&b, cur_len + 1); memcpy(dest + len, cur, cur_len); len += cur_len; } @@ -467,7 +467,7 @@ rule_file_load(const char *filename) return NULL; obj = json_object_from_file((char *) filename); - if (!obj) + if (is_error(obj)) return NULL; if (!json_object_is_type(obj, json_type_array)) {