virtio-gpu: fix memory leak in error path
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 18 Dec 2015 10:55:01 +0000 (11:55 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 3 Feb 2016 09:41:36 +0000 (10:41 +0100)
Found by Coverity Scan, buf not freed on error.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
hw/display/virtio-gpu-3d.c

index 59581a4..e13122d 100644 (file)
@@ -198,7 +198,7 @@ static void virgl_cmd_submit_3d(VirtIOGPU *g,
         qemu_log_mask(LOG_GUEST_ERROR, "%s: size mismatch (%zd/%d)",
                       __func__, s, cs.size);
         cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;
-        return;
+        goto out;
     }
 
     if (virtio_gpu_stats_enabled(g->conf)) {
@@ -208,6 +208,7 @@ static void virgl_cmd_submit_3d(VirtIOGPU *g,
 
     virgl_renderer_submit_cmd(buf, cs.hdr.ctx_id, cs.size / 4);
 
+out:
     g_free(buf);
 }