From 69fb67289f65d6ccf1e66837323daaed72bea928 Mon Sep 17 00:00:00 2001 From: kalpak Date: Wed, 18 Feb 2009 17:29:57 +0000 Subject: [PATCH] b=18532 o=huanghua i=nathan i=kalpak fix possible memory leak in mdd_dot_lustre_setup() and create_dot_lustre_dir() --- lustre/mdd/mdd_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index 8236e3d..c47a0b5 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -326,6 +326,9 @@ static int create_dot_lustre_dir(const struct lu_env *env, struct mdd_device *m) RETURN(rc); } + if (!IS_ERR(mdo)) + lu_object_put(env, &mdo->mo_lu); + return 0; } @@ -672,8 +675,6 @@ static int mdd_dot_lustre_setup(const struct lu_env *env, struct mdd_device *m) m->mdd_dot_lustre = lu2mdd_obj(lu_object_locate(dt_dot_lustre->do_lu.lo_header, &mdd_device_type)); - lu_object_put(env, &dt_dot_lustre->do_lu); - m->mdd_dot_lustre->mod_obj.mo_dir_ops = &mdd_dot_lustre_dir_ops; m->mdd_dot_lustre->mod_obj.mo_ops = &mdd_dot_lustre_obj_ops; -- 1.8.3.1