]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vboxDomainScreenshot: Don't pass uninitialized 'screenData' to VIR_FREE
authorPeter Krempa <pkrempa@redhat.com>
Thu, 11 Jun 2020 08:38:05 +0000 (10:38 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 15 Jun 2020 08:27:37 +0000 (10:27 +0200)
If one of the early checks to get screen resolution fails 'screenData'
would be passed to VIR_FREE uninitialized. Unfortunately the compiler
isn't able to detect this when VIR_FREE is implemented using
g_clear_pointer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com
src/vbox/vbox_common.c

index a834a971f0d8ffff535896062255db4cbde75b50..85935ba7315345fbfe4188f5f4cbe47afbfc0a75 100644 (file)
@@ -7418,7 +7418,7 @@ vboxDomainScreenshot(virDomainPtr dom,
             if (display) {
                 PRUint32 width, height, bitsPerPixel;
                 PRUint32 screenDataSize;
-                PRUint8 *screenData;
+                PRUint8 *screenData = NULL;
                 PRInt32 xOrigin, yOrigin;
 
                 rc = gVBoxAPI.UIDisplay.GetScreenResolution(display, screen,