Skip to contentSkip to conversation

virtio-gpu: fix memory leak in error path

PATCH New Gerd Hoffmann 1 participant 1 message Dec 18, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-gpu: fix memory leak in error path

Found by Coverity Scan, buf not freed on error.

---
 hw/display/virtio-gpu-3d.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/display/virtio-gpu-3d.c +2 -1
index 527ac90..bd88d45 100644
@@ -197,7 +197,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)) {
@@ -207,6 +207,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);
 }
 
Signature · 1 line
1.8.3.1