exec: always call finish_cb to allow plugin to free up memory
authorYousong Zhou <yszhou4tech@gmail.com>
Mon, 21 Oct 2019 06:10:28 +0000 (06:10 +0000)
committerJo-Philipp Wich <jo@mein.io>
Tue, 29 Oct 2019 08:24:46 +0000 (09:24 +0100)
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
[fix whitespace, subject typo]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
exec.c

diff --git a/exec.c b/exec.c
index f490ad7c11bd89644f617533cd1ead0aa65b6e03..3cd7384999ad460f979c2ce96e534467d3ecadf2 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -131,13 +131,13 @@ rpc_exec_reply(struct rpc_exec_context *c, int rv)
                        rpc_ustream_to_blobmsg(&c->blob, &c->opipe.stream, "stdout");
                        rpc_ustream_to_blobmsg(&c->blob, &c->epipe.stream, "stderr");
                }
+       }
 
-               if (c->finish_cb)
-                       rv = c->finish_cb(&c->blob, c->stat, c->priv);
+       if (c->finish_cb)
+               rv = c->finish_cb(&c->blob, c->stat, c->priv);
 
-               if (rv == UBUS_STATUS_OK)
-                       ubus_send_reply(c->context, &c->request, c->blob.head);
-       }
+       if (rv == UBUS_STATUS_OK)
+               ubus_send_reply(c->context, &c->request, c->blob.head);
 
        ubus_complete_deferred_request(c->context, &c->request, rv);