]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
PM / devfreq: fix mem leak in devfreq_add_device()
authorYangtao Li <tiny.windzz@gmail.com>
Sat, 19 Jan 2019 16:04:54 +0000 (11:04 -0500)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Tue, 16 Apr 2019 00:29:18 +0000 (09:29 +0900)
'devfreq' is malloced in devfreq_add_device() and should be freed in
the error handling cases, otherwise it will cause memory leak.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
drivers/devfreq/devfreq.c

index 0ae3de76833b7da0c16f01ca79e482ec66217594..fa1bdde89ffc9a30745606b520e1008b3f27cb2a 100644 (file)
@@ -651,7 +651,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
                mutex_unlock(&devfreq->lock);
                err = set_freq_table(devfreq);
                if (err < 0)
-                       goto err_out;
+                       goto err_dev;
                mutex_lock(&devfreq->lock);
        }