From f27feb2b79e1c4aa9211addedf3549680c96238d Mon Sep 17 00:00:00 2001 From: adilger Date: Sat, 21 Jan 2006 00:53:46 +0000 Subject: [PATCH] Branch b_release_1_4_6 Fix memory leak found by Coverity - we were not freeing any of the other allocated structs if there was a later allocation error. --- lustre/lov/lov_qos.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lustre/lov/lov_qos.c b/lustre/lov/lov_qos.c index a39540f..bde768b 100644 --- a/lustre/lov/lov_qos.c +++ b/lustre/lov/lov_qos.c @@ -165,12 +165,17 @@ int qos_prep_create(struct lov_obd *lov, struct lov_request_set *set, int newea) req->rq_buflen = sizeof(*req->rq_md); OBD_ALLOC(req->rq_md, req->rq_buflen); - if (req->rq_md == NULL) + if (req->rq_md == NULL) { + OBD_FREE_PTR(req); GOTO(out, rc = -ENOMEM); + } req->rq_oa = obdo_alloc(); - if (req->rq_oa == NULL) + if (req->rq_oa == NULL) { + OBD_FREE_PTR(req->rq_md); + OBD_FREE_PTR(req); GOTO(out, rc = -ENOMEM); + } req->rq_idx = ost_idx; req->rq_stripe = i; @@ -217,5 +222,6 @@ int qos_prep_create(struct lov_obd *lov, struct lov_request_set *set, int newea) rc = 0; } out: + RETURN(rc); } -- 1.8.3.1