Peter Xu <pet...@redhat.com> wrote: > On Fri, Jun 02, 2017 at 12:08:13AM +0200, Juan Quintela wrote: >> We create the variable while we are at migration and we remove it >> after migration. >> >> Signed-off-by: Juan Quintela <quint...@redhat.com>
>> @@ -1818,6 +1825,8 @@ static int ram_state_init(RAMState *rs) >> error_report("Error allocating current_buf"); >> g_free(XBZRLE.encoded_buf); >> XBZRLE.encoded_buf = NULL; >> + g_free(*rsp); >> + *rsp = NULL; > > Though may not be directly related to this patch, but... do we need to > destroy the two mutexes as well? > > (*rsp)->bitmap_mutex > (*rsp)->src_page_req_mutex > I guess so. Will do on a next series. > Also a nit: These several places I would slightly prefer a "goto > xbzrle_fail", then: > > xbzrle_fail: > if (XBZRLE.encoded_buf) { > g_free(XBZRLE.encoded_buf); > XBZRLE.encoded_buf = NULL; > } > qemu_mutex_destroy(&(*rsp)->bitmap_mutex); > qemu_mutex_destroy(&(*rsp)->src_page_req_mutex); > g_free(*rsp); > *rsp = NULL; > return -1; > My idea is to split the XBZRLE bits from being all overal the code. But that would be later O:-) Later, Juan.