From dc05d7a89e0040e7b4d22d149c2f1451b2520830 Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Fri, 1 Sep 2023 12:42:18 +0530 Subject: [PATCH] LU-17000 utils: Fix Resourse leak under mount_utils.c 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 Change-Id: Ib3281d922936822a0ac298a15d6e8863b3c2c9b7 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52218 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin --- lustre/utils/mount_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lustre/utils/mount_utils.c b/lustre/utils/mount_utils.c index 41e8713..4313c86 100644 --- a/lustre/utils/mount_utils.c +++ b/lustre/utils/mount_utils.c @@ -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; } -- 1.8.3.1