migration_init: Fix lock initialisation/make it explicit
commit389775d1f67b2c8f44f9473b1e5363735972e389
authorDr. David Alan Gilbert <dgilbert@redhat.com>
Thu, 12 Nov 2015 15:38:27 +0000 (12 15:38 +0000)
committerJuan Quintela <quintela@redhat.com>
Thu, 12 Nov 2015 16:55:27 +0000 (12 17:55 +0100)
treead1804bc9419188fea46330d038de3d3159e5b36
parenta54d340b9d0902fa73ff9e5541974b9b51fb1d45
migration_init: Fix lock initialisation/make it explicit

Peter reported a lock error on MacOS after my a82d593b
patch.

migrate_get_current does one-time initialisation of
a bunch of variables.
migrate_init does reinitialisation even on a 2nd
migrate after a cancel.

The problem here was that I'd initialised the mutex
in migrate_get_current, and the memset in migrate_init
corrupted it.

Remove the memset and replace it by explicit initialisation
of fields that need initialising; this also turns out to be simpler
than the old code that had to preserve some fields.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Fixes: a82d593b
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
migration/migration.c