[Debian-ha-commits] [ocfs2-tools] 19/58: tunefs.ocfs2: fix memory leak problems in tunefs_journal_check() and parse_options()

Valentin Vidic vvidic-guest at moszumanska.debian.org
Tue Jun 20 13:40:41 UTC 2017


This is an automated email from the git hooks/post-receive script.

vvidic-guest pushed a commit to branch upstream
in repository ocfs2-tools.

commit 79ec217ccd03dbe68bce8338e4a39489aa1eed2a
Author: piaojun <piaojun at huawei.com>
Date:   Thu Aug 18 11:12:06 2016 +0800

    tunefs.ocfs2: fix memory leak problems in tunefs_journal_check() and parse_options()
    
    Two memory leak problems were found in tunefs.ocfs2 described as bellow:
    1. Free 'ci' in each cycle of the loop in tunefs_journal_check();
    2. Free 'long_options' and 'optstring' at the end of parse_options().
    
    Signed-off-by: Jun Piao <piaojun at huawei.com>
    Reviewed-by: Joseph Qi <joseph.qi at huawei.com>
---
 tunefs.ocfs2/libocfs2ne.c | 1 +
 tunefs.ocfs2/ocfs2ne.c    | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/tunefs.ocfs2/libocfs2ne.c b/tunefs.ocfs2/libocfs2ne.c
index 1f4796b..20bee9f 100644
--- a/tunefs.ocfs2/libocfs2ne.c
+++ b/tunefs.ocfs2/libocfs2ne.c
@@ -1794,6 +1794,7 @@ static errcode_t tunefs_journal_check(ocfs2_filesys *fs)
 			jsb->s_feature_ro_compat;
 		state->ts_journal_features.opt_incompat |=
 			jsb->s_feature_incompat;
+		ocfs2_free_cached_inode(fs, ci);
 	}
 
 	/*
diff --git a/tunefs.ocfs2/ocfs2ne.c b/tunefs.ocfs2/ocfs2ne.c
index d2f06e4..368d316 100644
--- a/tunefs.ocfs2/ocfs2ne.c
+++ b/tunefs.ocfs2/ocfs2ne.c
@@ -1002,6 +1002,8 @@ static errcode_t parse_options(int argc, char *argv[], char **device)
 	}
 
 out:
+	ocfs2_free(&optstring);
+	ocfs2_free(&long_options);
 	return err;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/ocfs2-tools.git



More information about the Debian-HA-Commits mailing list