From 32fba361d51f01c3f26d4ab1a770773427ad3c48 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Mon, 21 Oct 2019 06:10:28 +0000 Subject: [PATCH] exec: always call finish_cb to allow plugin to free up memory Signed-off-by: Yousong Zhou [fix whitespace, subject typo] Signed-off-by: Jo-Philipp Wich --- exec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exec.c b/exec.c index f490ad7..3cd7384 100644 --- a/exec.c +++ b/exec.c @@ -131,14 +131,14 @@ 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 (rv == UBUS_STATUS_OK) - ubus_send_reply(c->context, &c->request, c->blob.head); } + 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); + ubus_complete_deferred_request(c->context, &c->request, rv); blob_buf_free(&c->blob);