From 1dfc46dd4c54b1267d3a5b4e038d10dc0c9f03d1 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 11 Jul 2005 11:28:09 +0000 Subject: [PATCH] - memleak in mds_create_objects(): we should free ids array if an error is returned --- lustre/mds/mds_open.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index 7910673..89f7665 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -367,7 +367,7 @@ mds_create_objects(struct obd_device *obd, struct ptlrpc_request *req, } if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_MDS_ALLOC_OBDO)) - RETURN(-ENOMEM); + GOTO(out_ids, rc = -ENOMEM); oa = obdo_alloc(); if (oa == NULL) @@ -489,7 +489,11 @@ mds_create_objects(struct obd_device *obd, struct ptlrpc_request *req, out_oa: oti_free_cookies(&oti); obdo_free(oa); - +out_ids: + if (rc) { + OBD_FREE(*ids, mds->mds_dt_desc.ld_tgt_count * sizeof(**ids)); + *ids = NULL; + } if (lsm) obd_free_memmd(mds->mds_dt_exp, &lsm); RETURN(rc); -- 1.8.3.1