diff mbox

[2/3] example: ipsec: add termination path

Message ID 1469675371-20274-2-git-send-email-forrest.shi@linaro.org
State New
Headers show

Commit Message

Forrest Shi July 28, 2016, 3:09 a.m. UTC
From: Xuelin Shi <forrest.shi@linaro.org>


release resources on exit

Signed-off-by: Xuelin Shi <forrest.shi@linaro.org>

---
 example/ipsec/odp_ipsec.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

-- 
2.1.0.27.g96db324
diff mbox

Patch

diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 6a9a9fe..f0797cd 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1361,6 +1361,32 @@  main(int argc, char *argv[])
 
 	free(args->appl.if_names);
 	free(args->appl.if_str);
+
+	if (odp_pool_destroy(pkt_pool)) {
+		EXAMPLE_ERR("Error: pkt pool destroy\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (odp_pool_destroy(out_pool)) {
+		EXAMPLE_ERR("Error: out pool destroy\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (odp_pool_destroy(ctx_pool)) {
+		EXAMPLE_ERR("Error: ctx pool destroy\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (odp_term_local()) {
+		EXAMPLE_ERR("Error: term local\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (odp_term_global(instance)) {
+		EXAMPLE_ERR("Error: term global\n");
+		exit(EXIT_FAILURE);
+	}
+
 	printf("Exit\n\n");
 
 	return 0;