[Libva] [PATCH 1/6] Fix memory leak issue in open_display func

Lim Siew Hoon siew.hoon.lim at intel.com
Fri Jul 1 05:29:08 UTC 2016


If the !d->display is true, will exit without free memory
block allocate for 'd'.

Signed-off-by: Lim Siew Hoon <siew.hoon.lim at intel.com>
---
 test/putsurface/putsurface_wayland.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/test/putsurface/putsurface_wayland.c b/test/putsurface/putsurface_wayland.c
index b93334d..c3b504f 100644
--- a/test/putsurface/putsurface_wayland.c
+++ b/test/putsurface/putsurface_wayland.c
@@ -207,8 +207,10 @@ open_display(void)
         return NULL;
 
     d->display = wl_display_connect(NULL);
-    if (!d->display)
+    if (!d->display){
+        free(d);
         return NULL;
+    }
 
     wl_display_set_user_data(d->display, d);
     d->registry = wl_display_get_registry(d->display);
-- 
2.1.0



More information about the Libva mailing list