qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] hw: pvrdma: fix memory leak in error path


From: 李强
Subject: Re: [Qemu-devel] [PATCH] hw: pvrdma: fix memory leak in error path
Date: Tue, 8 Jan 2019 14:40:33 +0800 (CST)

At 2019-01-08 00:26:58, "Yuval Shaia" <address@hidden> wrote:
>On Thu, Jan 03, 2019 at 02:47:37PM +0100, Philippe Mathieu-Daudé wrote:
>> On 1/3/19 2:03 PM, Li Qiang wrote:
>> > Spotted by Coverity: CID 1398595
>> > 
>> 
>> Fixes: 2b05705dc8
>> 
>> > Signed-off-by: Li Qiang <address@hidden>
>> 
>> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
>> 
>> > ---
>> >  hw/rdma/vmw/pvrdma_qp_ops.c | 2 ++
>> >  1 file changed, 2 insertions(+)
>> > 
>> > diff --git a/hw/rdma/vmw/pvrdma_qp_ops.c b/hw/rdma/vmw/pvrdma_qp_ops.c
>> > index 300471a4c9..584be2043e 100644
>> > --- a/hw/rdma/vmw/pvrdma_qp_ops.c
>> > +++ b/hw/rdma/vmw/pvrdma_qp_ops.c
>> > @@ -168,6 +168,7 @@ int pvrdma_qp_send(PVRDMADev *dev, uint32_t qp_handle)
>> >          sgid = rdma_rm_get_gid(&dev->rdma_dev_res, 
>> > wqe->hdr.wr.ud.av.gid_index);
>> >          if (!sgid) {
>> >              pr_dbg("Fail to get gid for idx %d\n", 
>> > wqe->hdr.wr.ud.av.gid_index);
>> > +            g_free(comp_ctx);
>> >              return -EIO;
>> >          }
>> >          pr_dbg("sgid_id=%d, sgid=0x%llx\n", wqe->hdr.wr.ud.av.gid_index,
>> > @@ -179,6 +180,7 @@ int pvrdma_qp_send(PVRDMADev *dev, uint32_t qp_handle)
>> >          if (sgid_idx <= 0) {
>> >              pr_dbg("Fail to get bk sgid_idx for sgid_idx %d\n",
>> >                     wqe->hdr.wr.ud.av.gid_index);
>> > +            g_free(comp_ctx);
>> >              return -EIO;
>> >          }
>
>Since comp_ctx is not used until the two checks are done we just can
>relocate the allocation & initialization right after the two checks.

>


OK, will send a revised version later.


Thanks,
Li Qiang


>Yuval
>
>> >  
>> > 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]