On Wed, Mar 13, 2024 at 06:28:23PM -0300, Fabiano Rosas wrote: > The memory for the io channels is being leaked in three different ways > during file migration: > > 1) if the offset check fails we never drop the ioc reference; > > 2) we allocate an extra channel for no reason; > > 3) if multifd is enabled but channel creation fails when calling > dup(), we leave the previous channels around along with the glib > polling; > > Fix all issues by restructuring the code to first allocate the > channels and only register the watches when all channels have been > created. > > For multifd, the file and fd migrations can share code because both > are backed by a QIOChannelFile. For the non-multifd case, the fd needs > to be separate because it is backed by a QIOChannelSocket. > > Fixes: 2dd7ee7a51 ("migration/multifd: Add incoming QIOChannelFile support") > Fixes: decdc76772 ("migration/multifd: Add mapped-ram support to fd: URI") > Reported-by: Peter Xu <pet...@redhat.com> > Signed-off-by: Fabiano Rosas <faro...@suse.de>
Reviewed-by: Peter Xu <pet...@redhat.com> -- Peter Xu