From 6d5985f5b472d49046e54748f9696e0c93119647 Mon Sep 17 00:00:00 2001 From: huanghua <huanghua> Date: Thu, 7 Aug 2008 03:10:51 +0000 Subject: [PATCH] Branch HEAD b=16577 i=yong.fan i=nikita.danilov fix memory leak in osd_device_alloc() --- lustre/osd/osd_handler.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index 7f1991f8c0..b1df1f6ba8 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; -- GitLab