diff mbox series

[PULL,02/11] ui/spice-display: check NULL pointer in interface_release_resource()

Message ID 20210521125119.3173309-3-kraxel@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,01/11] vnc: spelling fix (enable->enabled) | expand

Commit Message

Gerd Hoffmann May 21, 2021, 12:51 p.m. UTC
From: Mauro Matteo Cascella <mcascell@redhat.com>

Check rext.info to avoid potential NULL pointer dereference. A similar check
exists in interface_release_resource() in hw/display/qxl.c.

Reported-by: Yu Lu <ini.universe@gmail.com>
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-Id: <20210520105833.183160-1-mcascell@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/spice-display.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/ui/spice-display.c b/ui/spice-display.c
index d22781a23d06..f59c69882d91 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -561,6 +561,10 @@  static void interface_release_resource(QXLInstance *sin,
     SimpleSpiceCursor *cursor;
     QXLCommandExt *ext;
 
+    if (!rext.info) {
+        return;
+    }
+
     ext = (void *)(intptr_t)(rext.info->id);
     switch (ext->cmd.type) {
     case QXL_CMD_DRAW: