From d792434348bdb42cd53d575b8f0fbf042841010a Mon Sep 17 00:00:00 2001 From: Takahiro Yamashita Date: Mon, 18 Sep 2023 09:05:08 +0900 Subject: [PATCH] kernel: add release function Signed-off-by: Takahiro Yamashita --- include/fluent-bit/flb_kernel.h | 1 + src/flb_kernel.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/fluent-bit/flb_kernel.h b/include/fluent-bit/flb_kernel.h index 21a9d05c808..116b4a79d9a 100644 --- a/include/fluent-bit/flb_kernel.h +++ b/include/fluent-bit/flb_kernel.h @@ -35,5 +35,6 @@ struct flb_kernel { }; struct flb_kernel *flb_kernel_info(); +void flb_kernel_destroy(struct flb_kernel *kernel); #endif diff --git a/src/flb_kernel.c b/src/flb_kernel.c index 5e5fa886abb..d29ba922fe9 100644 --- a/src/flb_kernel.c +++ b/src/flb_kernel.c @@ -147,3 +147,15 @@ struct flb_kernel *flb_kernel_info() } #endif + +void flb_kernel_destroy(struct flb_kernel *kernel) +{ + if (kernel == NULL) { + return; + } + + if (kernel->s_version.data) { + flb_free(kernel->s_version.data); + } + flb_free(kernel); +}