[Spice-devel] [PATCH qxl-wddm-dod 5/8] Remove possible future memory leak

Frediano Ziglio fziglio at redhat.com
Wed Sep 28 13:55:44 UTC 2016


The SetClip function is not currently called by
the code however it contains a leak as the missing
call to RELEASE_RES cause the reference counter
to be 2 so won't be freed when resources are freed.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 qxldod/QxlDod.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 78982a7..4b27b9c 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -4071,6 +4071,7 @@ BOOL QxlDevice::SetClip(const RECT *clip, QXLDrawable *drawable)
     CopyRect((QXLRect *)rects->chunk.data, clip);
 
     DrawableAddRes(drawable, rects_res);
+    RELEASE_RES(rects_res);
     drawable->clip.type = SPICE_CLIP_TYPE_RECTS;
     drawable->clip.data = PA(rects_res->res, m_SurfaceMemSlot);
     return TRUE;
-- 
2.7.4



More information about the Spice-devel mailing list