aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2016-12-02 10:18:06 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-18 01:11:46 -0400
commitdcac0d18e7e1ee4ae524ae9c672a35b86189a260 (patch)
tree83539655629227cda722a2d778cec3e1988b9bc5
parent17fda94d181c75d95dc9ab3db39813a0efeccafb (diff)
orangefs: fix memory leak of string 'new' on exit path
commit 4defb5f912a0ba60e07e91a4b62634814cd99b7f upstream. 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> Signed-off-by: Martin Brandenburg <martin@omnibond.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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)
671 */ 671 */
672 cdm_element_count = 672 cdm_element_count =
673 orangefs_prepare_cdm_array(client_debug_array_string); 673 orangefs_prepare_cdm_array(client_debug_array_string);
674 if (cdm_element_count <= 0) 674 if (cdm_element_count <= 0) {
675 kfree(new);
675 goto out; 676 goto out;
677 }
676 678
677 for (i = 0; i < cdm_element_count; i++) { 679 for (i = 0; i < cdm_element_count; i++) {
678 strlcat(new, "\t", string_size); 680 strlcat(new, "\t", string_size);