* [PATCH] watchdog: fix memory leak in error path
@ 2020-09-20 8:37 Pavel Machek
2020-09-20 16:21 ` Christophe Leroy
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Machek @ 2020-09-20 8:37 UTC (permalink / raw)
To: wim, linux, linux-watchdog, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 795 bytes --]
Fix memory leak in error path.
Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index 6798addabd5a..785270ee337c 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -994,8 +994,10 @@ static int watchdog_cdev_register(struct watchdog_device *wdd)
wd_data->wdd = wdd;
wdd->wd_data = wd_data;
- if (IS_ERR_OR_NULL(watchdog_kworker))
+ if (IS_ERR_OR_NULL(watchdog_kworker)) {
+ kfree(wd_data);
return -ENODEV;
+ }
device_initialize(&wd_data->dev);
wd_data->dev.devt = MKDEV(MAJOR(watchdog_devt), wdd->id);
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-20 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-20 8:37 [PATCH] watchdog: fix memory leak in error path Pavel Machek
2020-09-20 16:21 ` Christophe Leroy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.