aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorPan Nengyuan <pannengyuan@huawei.com>2020-05-08 06:07:54 -0400
committerDr. David Alan Gilbert <dgilbert@redhat.com>2020-06-01 18:44:27 +0100
commit3b59ee722726d023f4a56d711aef362ab9ba777e (patch)
tree573a79c5bf54688e9530b6dd2e0f3f42149d9966 /migration
parent7ea32024c6b3ad9c88d6200e73dbf76c8e160024 (diff)
downloadqemu-3b59ee722726d023f4a56d711aef362ab9ba777e.zip
qemu-3b59ee722726d023f4a56d711aef362ab9ba777e.tar.gz
qemu-3b59ee722726d023f4a56d711aef362ab9ba777e.tar.bz2
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: 59c59c67ee6b0327ae932deb303caa47919aeb1e 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
Diffstat (limited to 'migration')
-rw-r--r--migration/rdma.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/migration/rdma.c b/migration/rdma.c
index 967fda5..72e8b1c 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -4056,7 +4056,9 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
return;
err:
error_propagate(errp, local_err);
- g_free(rdma->host);
+ if (rdma) {
+ g_free(rdma->host);
+ }
g_free(rdma);
g_free(rdma_return_path);
}