aboutsummaryrefslogtreecommitdiffstats
path: root/fs/orangefs
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2016-12-02 15:18:06 +0000
committerMike Marshall <hubcap@omnibond.com>2016-12-12 11:43:25 -0500
commit4defb5f912a0ba60e07e91a4b62634814cd99b7f (patch)
tree188a7ac96b34b16c7f2d5cb831f3bf2b86ebb2e2 /fs/orangefs
parentorangefs: add .owner to debugfs file_operations (diff)
downloadlinux-dev-4defb5f912a0ba60e07e91a4b62634814cd99b7f.tar.xz
linux-dev-4defb5f912a0ba60e07e91a4b62634814cd99b7f.zip
orangefs: fix memory leak of string 'new' on exit path
allocates string 'new' is not free'd on the exit path when cdm_element_count <= 0. Fix this by kfree'ing it. Fixes CoverityScan CID#1375923 "Resource Leak" Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs')
-rw-r--r--fs/orangefs/orangefs-debugfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c
index 38887cc5577f..b5dbc9c6530c 100644
--- a/fs/orangefs/orangefs-debugfs.c
+++ b/fs/orangefs/orangefs-debugfs.c
@@ -671,8 +671,10 @@ int orangefs_prepare_debugfs_help_string(int at_boot)
*/
cdm_element_count =
orangefs_prepare_cdm_array(client_debug_array_string);
- if (cdm_element_count <= 0)
+ if (cdm_element_count <= 0) {
+ kfree(new);
goto out;
+ }
for (i = 0; i < cdm_element_count; i++) {
strlcat(new, "\t", string_size);