]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
migration/rdma: fix potential nullptr access in rdma_start_incoming_migration
authorPan Nengyuan <pannengyuan@huawei.com>
Fri, 8 May 2020 10:07:54 +0000 (06:07 -0400)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Mon, 1 Jun 2020 17:44:27 +0000 (18:44 +0100)
'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

migration/rdma.c

index 967fda5b0c75a5e0ce2d70eed1a719d5d22d2c5c..72e8b1c95ba4f36a7136179352a8870b53737d32 100644 (file)
@@ -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);
 }