plugin: do not free method name separately
authorJo-Philipp Wich <jo@mein.io>
Tue, 29 Oct 2019 08:04:55 +0000 (09:04 +0100)
committerJo-Philipp Wich <jo@mein.io>
Tue, 29 Oct 2019 08:23:30 +0000 (09:23 +0100)
A previous commit changed the allocation method for the call context to
include the method name string memory directly, so we must not treat the
method member separately anymore.

Fixes: 37aa919 ("plugin: fix leaking invoked method name for exec plugins")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
plugin.c

index bf7c74db5d5253d4f5f6a6971e3dd9b55f36c6a8..4f84994c107f40269e8b4aba9146cc82632b0048 100644 (file)
--- a/plugin.c
+++ b/plugin.c
@@ -146,7 +146,7 @@ rpc_plugin_call(struct ubus_context *ctx, struct ubus_object *obj,
        c->input = blobmsg_format_json(msg, true);
        c->tok = json_tokener_new();
 
-       if (!c->method || !c->input || !c->tok)
+       if (!c->input || !c->tok)
                goto fail;
 
        plugin = c->path + sprintf(c->path, "%s/", RPC_PLUGIN_DIRECTORY);
@@ -171,9 +171,6 @@ rpc_plugin_call(struct ubus_context *ctx, struct ubus_object *obj,
 fail:
        if (c)
        {
-               if (c->method)
-                       free(c->method);
-
                if (c->input)
                        free(c->input);