On 01/21/2014 02:58 PM, Gonglei (Arei) wrote:

-----Original Message-----
From: Orit Wasserman [mailto:owass...@redhat.com]
Sent: Tuesday, January 21, 2014 8:24 PM
To: Gonglei (Arei); qemu-devel@nongnu.org; qemu-sta...@nongnu.org; Peter
Maydell; anth...@codemonkey.ws; pbonz...@redhat.com
Cc: chenliang (T); Luonengjun; Huangweidong (Hardware)
Subject: Re: [Qemu-devel] [PATCH v2] migration:fix free XBZRLE decoded_buf
wrong

On 01/21/2014 02:11 PM, Gonglei (Arei) wrote:
Hi,

This is an update of my patch.
Modifications in v2:
* Removing excess check for g_free
* The structure of XBZRLE is divided into two halves.One is for
* src side, another is for dest side.


What is the benefit of splitting the structure?
decode_buf is only allocated (and freed) in the destination any way.

Yeah, you are right. Splitting the structure is not necessary.
The key to do that is just for clear logic. As Peter said:
the current arrangement looks extremely prone to bugs like
this one where somebody forgets that some of the fields are
not relevant to whichever of src/dst the code path they're
writing is used on.

Best regards,
-Gonglei


Sounds reasonable.
Thanks for finding the leak and fixing it.

Orit

Orit


Reply via email to