From: tappro Date: Fri, 20 Oct 2006 05:30:48 +0000 (+0000) Subject: - avoid possible memleak X-Git-Tag: v1_8_0_110~486^2~429 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=ce586944802213d137b2ff64c39be964279dc741;p=fs%2Flustre-release.git - avoid possible memleak --- 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);