xfs
[Top] [All Lists]

[PATCH] xfsprogs: fix potential memory leak in verify_set_primary_sb()

To: xfsprogs <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfsprogs: fix potential memory leak in verify_set_primary_sb()
From: Li Zhong <zhong@xxxxxxxxxxxxxxxxxx>
Date: Sun, 22 Sep 2013 14:01:19 +0800
Cc: Chandra Seetharaman <sekharan@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
This patch tries to fix CID 997012, 997013 and 997014 reported by Coverity scan,
as suggested by sekharan.

Signed-off-by: Li Zhong <zhong@xxxxxxxxxxxxxxxxxx>
---
 repair/sb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/repair/sb.c b/repair/sb.c
index aa550e3..7abf47c 100644
--- a/repair/sb.c
+++ b/repair/sb.c
@@ -756,8 +756,10 @@ verify_set_primary_sb(xfs_sb_t             *rsb,
        /*
         * see if we have enough superblocks to bother with
         */
-       if (num_ok < num_sbs / 2)
-               return(XR_INSUFF_SEC_SB);
+       if (num_ok < num_sbs / 2) {
+               retval = XR_INSUFF_SEC_SB;
+               goto out_free_list;
+       }
 
        current = get_best_geo(list);
 
-- 
1.8.1.4



<Prev in Thread] Current Thread [Next in Thread>