lkml.org 
[lkml]   [2023]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH 1/3] kobject: Add a jump label in kobject_uevent_env()
From
From: Markus Elfring <elfring@users.sourceforge.net>
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@users.sourceforge.net>
---
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

\
 
 \ /
  Last update: 2023-12-19 16:35    [W:0.047 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site