Fix memory leak found by Coverity - we were not freeing any of the
other allocated structs if there was a later allocation error.
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;
rc = 0;
}
out:
+
RETURN(rc);
}