diff mbox series

[OpenWrt-Devel,rpcd,3/4] exec: alway call finish_cb to allow plugin to free up memory

Message ID 20191020112608.129703-3-yszhou4tech@gmail.com
State Superseded
Headers show
Series [OpenWrt-Devel,rpcd,1/4] plugin: exec: properly free memory on parse error | expand

Commit Message

Yousong Zhou Oct. 20, 2019, 11:26 a.m. UTC
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
 exec.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/exec.c b/exec.c
index f490ad7..1b05a91 100644
--- a/exec.c
+++ b/exec.c
@@ -131,13 +131,12 @@  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);