OSDN Git Service

accel/kvm: Free as when an error occurred
authorAkihiko Odaki <akihiko.odaki@daynix.com>
Tue, 22 Aug 2023 16:31:04 +0000 (17:31 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 22 Aug 2023 16:31:04 +0000 (17:31 +0100)
An error may occur after s->as is allocated, for example if the
KVM_CREATE_VM ioctl call fails.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-id: 20230727073134.134102-6-akihiko.odaki@daynix.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: tweaked commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
accel/kvm/kvm-all.c

index 3bac5aa..ed30f41 100644 (file)
@@ -2765,6 +2765,7 @@ err:
     if (s->fd != -1) {
         close(s->fd);
     }
+    g_free(s->as);
     g_free(s->memory_listener.slots);
 
     return ret;