From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> Date: Tue, 19 Dec 2023 14:16:35 +0100 Use another label so that a call of the function “kfree” can be avoided after a failed call of the function “kobject_get_path”. Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- lib/kobject_uevent.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index fb9a2f06dd1e..811e579ed89d 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -529,7 +529,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, devpath = kobject_get_path(kobj, GFP_KERNEL); if (!devpath) { retval = -ENOENT; - goto exit; + goto free_env; } /* default keys */ @@ -623,6 +623,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, exit: kfree(devpath); +free_env: kfree(env); return retval; } -- 2.43.0