X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=proto-shell.c;h=02f1836d8da4764fb37ff82cd014fff739afa431;hp=2a5eda0144d37f3a2327af015ab4d595265b4d66;hb=587655b45085fcfc9c575792640c21c6ffb24f42;hpb=c173c610044890c539584f3beb927e71ff83c198 diff --git a/proto-shell.c b/proto-shell.c index 2a5eda0..02f1836 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -317,6 +317,7 @@ proto_shell_free(struct interface_proto_state *proto) struct proto_shell_state *state; state = container_of(proto, struct proto_shell_state, proto); + uloop_timeout_cancel(&state->teardown_timeout); proto_shell_clear_host_dep(state); netifd_kill_process(&state->script_task); netifd_kill_process(&state->proto_task); @@ -812,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;