[PATCH 1/3] kobject: Add a jump label in kobject_uevent_env()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux