From ce586944802213d137b2ff64c39be964279dc741 Mon Sep 17 00:00:00 2001 From: tappro Date: Fri, 20 Oct 2006 05:30:48 +0000 Subject: [PATCH] - avoid possible memleak --- lustre/cmm/cmm_split.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lustre/cmm/cmm_split.c b/lustre/cmm/cmm_split.c index 293a5bb..f4292a8 100644 --- a/lustre/cmm/cmm_split.c +++ b/lustre/cmm/cmm_split.c @@ -78,19 +78,18 @@ int cmm_mdsnum_check(const struct lu_env *env, struct md_object *mp, if (rc) RETURN(rc); - /* Skip checking the slave dirs (mea_count == 0) */ - if (ma->ma_lmv->mea_count == 0) - RETURN(0); - /* - * Get stripe by name to check the name belongs to master dir, - * otherwise return the -ERESTART - */ - stripe = mea_name2idx(ma->ma_lmv, name, strlen(name)); - - /* Master stripe is always 0 */ - if (stripe != 0) - rc = -ERESTART; + /* Skip checking the slave dirs (mea_count is 0) */ + if (ma->ma_lmv->mea_count != 0) { + /* + * Get stripe by name to check the name belongs to master dir, + * otherwise return the -ERESTART + */ + stripe = mea_name2idx(ma->ma_lmv, name, strlen(name)); + /* Master stripe is always 0 */ + if (stripe != 0) + rc = -ERESTART; + } OBD_FREE(ma->ma_lmv, ma->ma_lmv_size); } RETURN(rc); -- 1.8.3.1