s->setup_time = 0;
s->start_postcopy = false;
s->migration_thread_running = false;
- error_free(s->error);
- s->error = NULL;
+
+ migrate_error_free(s);
if (should_send_vmdesc()) {
s->vmdesc = json_writer_new(false);
migrate_set_state(&s->state, MIGRATION_STATUS_POSTCOPY_PAUSED,
MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP);
+ /*
+ * If there's a previous error, free it and prepare for
+ * another one. For the non-resume case, this happens at
+ * migrate_init() below.
+ */
+ migrate_error_free(s);
+
/* This is a resume, skip init status */
return true;
}
bool resume = (s->state == MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP);
int ret;
- /*
- * If there's a previous error, free it and prepare for another one.
- * Meanwhile if migration completes successfully, there won't have an error
- * dumped when calling migration_cleanup().
- */
- migrate_error_free(s);
-
s->expected_downtime = migrate_downtime_limit();
if (error_in) {
migration_connect_error_propagate(s, error_in);