Whamcloud - gitweb
LU-17000 utils: Fix Resourse leak under mount_utils.c 18/52218/3
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Fri, 1 Sep 2023 07:12:18 +0000 (12:42 +0530)
committerOleg Drokin <green@whamcloud.com>
Wed, 13 Sep 2023 04:07:12 +0000 (04:07 +0000)
This patch fixes resource leak error reported
by coverity run.

CoverityID: 399700 ("Resource leak"): mount_utils.c

Test-Parameters: trivial testlist=conf-sanity
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: Ib3281d922936822a0ac298a15d6e8863b3c2c9b7
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52218
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/mount_utils.c

index 41e8713..4313c86 100644 (file)
@@ -967,7 +967,7 @@ char *convert_hostnames(char *s1, bool mount)
                if (!end) {
                        fprintf(stderr, "%s: Invalid mount string: %s\n",
                                progname, s1);
-                       return NULL;
+                       goto out_bad_mnt_str;
                }
                end--;
        } else {
@@ -1028,6 +1028,7 @@ char *convert_hostnames(char *s1, bool mount)
        return converted;
 out_free:
        fprintf(stderr, "%s: Can't parse NID '%s'\n", progname, s1);
+out_bad_mnt_str:
        free(converted);
        return NULL;
 }