summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-01-05 16:13:29 +0100
committerFelix Fietkau <nbd@openwrt.org>2013-01-05 16:13:29 +0100
commit4108e7610019d63db6540de760feecf38c8b84dc (patch)
tree3db7b8d3ffe7081a66cea5beb72854b2a11d4ce2
parentc7539ced189392b73b76798a5cb865b59ab1283f (diff)
proto-shell: use calloc_a
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r--proto-shell.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/proto-shell.c b/proto-shell.c
index 038fb0b..02f1836 100644
--- a/proto-shell.c
+++ b/proto-shell.c
@@ -813,15 +813,12 @@ proto_shell_add_handler(const char *script, json_object *obj)
name = json_object_get_string(tmp);
- handler = calloc(1, sizeof(*handler) +
- strlen(script) + 1 +
- strlen(name) + 1);
+ handler = calloc_a(sizeof(*handler) + strlen(script) + 1,
+ &str, strlen(name) + 1);
if (!handler)
return;
strcpy(handler->script_name, script);
-
- str = handler->script_name + strlen(handler->script_name) + 1;
strcpy(str, name);
proto = &handler->proto;