migration/rdma: fix potential nullptr access in rdma_start_incoming_migration

'rdma' is NULL when taking the first error branch in rdma_start_incoming_migration.
And it will cause a null pointer access in label 'err'. Fix that.

Fixes: 59c59c67ee
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Message-Id: <20200508100755.7875-2-pannengyuan@huawei.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  Note this is CID 1428762
This commit is contained in:
Pan Nengyuan 2020-05-08 06:07:54 -04:00 committed by Dr. David Alan Gilbert
parent 7ea32024c6
commit 3b59ee7227

View File

@ -4056,7 +4056,9 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
return; return;
err: err:
error_propagate(errp, local_err); error_propagate(errp, local_err);
if (rdma) {
g_free(rdma->host); g_free(rdma->host);
}
g_free(rdma); g_free(rdma);
g_free(rdma_return_path); g_free(rdma_return_path);
} }