File kcm_opengl-Do-not-leak-XVisualInfo.patch of Package kdebase4-workspace

From d1355c3a1ca93a583663c118ee66da9516313c14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20Mal=C3=BD?= <madcatxster@devoid-pointer.net>
Date: Fri, 5 Jan 2018 23:03:05 +0100
Subject: [PATCH] Do not leak XVisualInfo (GLX path)

Summary: XVisualInfo is not released by get_gl_info()

Test Plan: Leak check with valgrind shows that visinfo is no longer leaking.

Reviewers: davidedmundson

Reviewed By: davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6567
---
 Modules/opengl/opengl.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kinfocenter/Modules/opengl/opengl.cpp b/kinfocenter/Modules/opengl/opengl.cpp
index ba405bc..7e5978c 100644
--- a/kinfocenter/Modules/opengl/opengl.cpp
+++ b/kinfocenter/Modules/opengl/opengl.cpp
@@ -738,6 +738,7 @@ static QTreeWidgetItem *get_gl_info(Display *dpy, int scrnum, Bool allowDirect, 
    if (!ctx) {
 		kDebug() << "Error: glXCreateContext failed\n";
       XDestroyWindow(dpy, win);
+      XFree(visinfo);
       return result;
    }
 
@@ -804,6 +805,8 @@ static QTreeWidgetItem *get_gl_info(Display *dpy, int scrnum, Bool allowDirect, 
    eglDestroySurface(egl_dpy, surf);
 #endif
    XDestroyWindow(dpy, win);
+   XFree(visinfo);
+
    return result;
 
 }
 
-- 
GitLab

openSUSE Build Service is sponsored by