Commit dcac0d18 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman

orangefs: fix memory leak of string 'new' on exit path

commit 4defb5f9 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: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
Signed-off-by: default avatarMartin Brandenburg <martin@omnibond.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 17fda94d
...@@ -671,8 +671,10 @@ int orangefs_prepare_debugfs_help_string(int at_boot) ...@@ -671,8 +671,10 @@ int orangefs_prepare_debugfs_help_string(int at_boot)
*/ */
cdm_element_count = cdm_element_count =
orangefs_prepare_cdm_array(client_debug_array_string); orangefs_prepare_cdm_array(client_debug_array_string);
if (cdm_element_count <= 0) if (cdm_element_count <= 0) {
kfree(new);
goto out; goto out;
}
for (i = 0; i < cdm_element_count; i++) { for (i = 0; i < cdm_element_count; i++) {
strlcat(new, "\t", string_size); strlcat(new, "\t", string_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment