Whamcloud - gitweb
LU-17000 coverity: Fix leak under mgc_request.c 56/52656/3
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Thu, 12 Oct 2023 08:46:43 +0000 (04:46 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 3 Nov 2023 04:06:17 +0000 (04:06 +0000)
This patch fixes resource leak error reported
by coverity run.

CoverityID: 403113 ("Resource leak"): mgc_request.c

Test-Parameters: trivial
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: Ie569a18cbacdb48c186d38ccc466ce86eeb1b28f
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52656
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mgc/mgc_request.c

index 2efb6c1..0d4777c 100644 (file)
@@ -1319,6 +1319,9 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,
                if (cname == NULL) {
                        CERROR("mgc %s: invalid logname %s\n",
                               mgc->obd_name, obdname);
+                       if (entry->mne_nid_type == 0)
+                               OBD_FREE_PTR_ARRAY(nidlist,
+                                                  entry->mne_nid_count);
                        break;
                }