[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120914065203.GB11886@elgon.mountain>
Date: Fri, 14 Sep 2012 09:52:03 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Peter Oberparleiter <oberpar@...ux.vnet.ibm.com>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch v2] gcov: add a kfree() on error to new_node()
We should free "node->loaded_info" on this error path. We'd never care
in real life but it makes the static checkers happy.
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
v2: some style changes.
diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c
index 9bd0934..7ba47f7 100644
--- a/kernel/gcov/fs.c
+++ b/kernel/gcov/fs.c
@@ -451,8 +451,7 @@ static struct gcov_node *new_node(struct gcov_node *parent,
node->dentry = debugfs_create_dir(node->name, parent->dentry);
if (!node->dentry) {
pr_warning("could not create file\n");
- kfree(node);
- return NULL;
+ goto err_info;
}
if (info)
add_links(node, parent->dentry);
@@ -461,6 +460,8 @@ static struct gcov_node *new_node(struct gcov_node *parent,
return node;
+err_info:
+ kfree(node->loaded_info);
err_nomem:
kfree(node);
pr_warning("out of memory\n");
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists