[sheepdog] [PATCH v1] sheep/gateway: fix memory leak in prepare_erasure_requests()
Hitoshi Mitake
mitake.hitoshi at gmail.com
Mon May 11 15:18:26 CEST 2015
At Mon, 11 May 2015 20:25:41 +0800,
Bingpeng Zhu wrote:
>
> In prepare_erasure_requests(), when init_erasure_buffer() returns NULL,
> we should release buffers of requests which are allocated via xmalloc().
>
> Signed-off-by: Bingpeng Zhu <bingpeng.zbp at alibaba-inc.com>
> ---
> sheep/gateway.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
Applied, thanks.
Hitoshi
>
> diff --git a/sheep/gateway.c b/sheep/gateway.c
> index 89db9bf..3cb21f0 100644
> --- a/sheep/gateway.c
> +++ b/sheep/gateway.c
> @@ -152,6 +152,8 @@ static struct req_iter *prepare_erasure_requests(struct request *req, int *nr)
> if (!buf) {
> sd_err("failed to init erasure buffer %"PRIx64,
> req->rq.obj.oid);
> + for (i = 0; i < nr_to_send; i++)
> + free(reqs[i].buf);
> free(reqs);
> reqs = NULL;
> goto out;
> --
> 1.7.1
>
>
>
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog
More information about the sheepdog
mailing list