]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
orangefs: fix memory leak of string 'new' on exit path
authorColin Ian King <colin.king@canonical.com>
Fri, 2 Dec 2016 15:18:06 +0000 (15:18 +0000)
committerMike Marshall <hubcap@omnibond.com>
Mon, 12 Dec 2016 16:43:25 +0000 (11:43 -0500)
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>
fs/orangefs/orangefs-debugfs.c

index 38887cc5577fa901acd907a0af2fb016a3441b2c..b5dbc9c6530cbcd6f6cdc5498ac1c8fa214c84de 100644 (file)
@@ -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);