From: Gowrishankar Muthukrishnan Date: Sat, 12 Feb 2022 12:39:47 +0000 (+0530) Subject: event/cnxk: fix memory leaks X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=315d14d7058e23d37dd198e9b3e766d43d7d0d4e;p=dpdk.git event/cnxk: fix memory leaks Fix memory leaks reported by coverity scan in cnxk_tim_parse_clk_list() and cnxk_tim_parse_ring_ctl_list() functions on not freeing strduped memory. Coverity issue: 374990 374991 Fixes: 8a3d58c189f ("event/cnxk: add option to control timer adapters") Cc: stable@dpdk.org Signed-off-by: Gowrishankar Muthukrishnan --- diff --git a/drivers/event/cnxk/cnxk_tim_evdev.c b/drivers/event/cnxk/cnxk_tim_evdev.c index 4d22ac6ac3..af67235503 100644 --- a/drivers/event/cnxk/cnxk_tim_evdev.c +++ b/drivers/event/cnxk/cnxk_tim_evdev.c @@ -560,7 +560,7 @@ cnxk_tim_parse_ring_ctl_list(const char *value, void *opaque) char *f = s; if (s == NULL || !strlen(s)) - return; + goto free; while (*s) { if (*s == '[') @@ -579,6 +579,7 @@ cnxk_tim_parse_ring_ctl_list(const char *value, void *opaque) s++; } +free: free(f); } @@ -607,7 +608,7 @@ cnxk_tim_parse_clk_list(const char *value, void *opaque) int i = 0; if (str == NULL || !strlen(str)) - return; + goto free; tok = strtok(str, "-"); while (tok != NULL && src[i] != ROC_TIM_CLK_SRC_INVALID) { @@ -616,6 +617,7 @@ cnxk_tim_parse_clk_list(const char *value, void *opaque) i++; } +free: free(str); }