Whamcloud - gitweb
LU-17000 coverity: Fix Resource Leak(1) 84/52384/2
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Fri, 15 Sep 2023 05:54:46 +0000 (11:24 +0530)
committerOleg Drokin <green@whamcloud.com>
Thu, 28 Sep 2023 08:02:07 +0000 (08:02 +0000)
This patch fixes Resource leak error reported
by coverity run.

CoverityID: 397493 ("Resource Leak"): liblustreapi_mirror.c
CoverityID: 397494 ("Resource Leak"): lustre_rsync.c

Test-Parameters: trivial fstype=zfs testlist=sanity,sanityn,conf-sanity
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I10e9fd0945cf13824c25faa62b4310796b09bade
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52384
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/liblustreapi_mirror.c
lustre/utils/lustre_rsync.c

index 55d9132..b93c948 100644 (file)
@@ -310,8 +310,10 @@ ssize_t llapi_mirror_copy_many(int fd, __u16 src, __u16 *dst, size_t count)
                                continue;
                        }
                }
-               if (!nr)
+               if (!nr) {
+                       free(buf);
                        return result;
+               }
        }
 
        while (!eof) {
index 944ec2e..f1c9a00 100644 (file)
@@ -1728,10 +1728,12 @@ int lr_replicate(void)
        rc = 0;
 
 out:
-       if (info)
-               free(info);
+       if (changelog_priv)
+               free(changelog_priv);
        if (ext)
                free(ext);
+       if (info)
+               free(info);
 
        return rc;
 }