From: huanghua Date: Thu, 7 Aug 2008 03:10:51 +0000 (+0000) Subject: Branch HEAD X-Git-Tag: v1_9_50~59 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=6d5985f5b472d49046e54748f9696e0c93119647;p=fs%2Flustre-release.git Branch HEAD b=16577 i=yong.fan i=nikita.danilov fix memory leak in osd_device_alloc() --- diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index 7f1991f..b1df1f6 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -2329,10 +2329,15 @@ static struct lu_device *osd_device_alloc(const struct lu_env *env, spin_lock_init(&o->od_osfs_lock); o->od_osfs_age = cfs_time_shift_64(-1000); o->od_capa_hash = init_capa_hash(); - if (o->od_capa_hash == NULL) + if (o->od_capa_hash == NULL) { + dt_device_fini(&o->od_dt_dev); l = ERR_PTR(-ENOMEM); + } } else l = ERR_PTR(result); + + if (IS_ERR(l)) + OBD_FREE_PTR(o); } else l = ERR_PTR(-ENOMEM); return l;