[PATCH 6/7] vboxDomainScreenshot: Don't pass uninitialized 'screenData' to VIR_FREE

Ján Tomko jtomko at redhat.com
Thu Jun 11 10:14:11 UTC 2020


On a Thursday in 2020, Peter Krempa wrote:
>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 at redhat.com>
>---
> src/vbox/vbox_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
>index a834a971f0..85935ba731 100644
>--- a/src/vbox/vbox_common.c
>+++ b/src/vbox/vbox_common.c
>@@ -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,

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200611/4b49a0ca/attachment-0001.sig>


More information about the libvir-list mailing list