From e6a3603b1f07cd85dbd84377afeda0777d6535e8 Mon Sep 17 00:00:00 2001
From: Zhang Dingyuan <justforlxz@gmail.com>
Date: Tue, 14 Jun 2022 11:37:40 +0800
Subject: [PATCH] fix: memory leak

agent listener does not reclaim private memory after destructing.
Use `QScopedPointer` to protect private pointers from being copied and to
reclaim memory properly.
---
 agent/polkitqt1-agent-listener.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/agent/polkitqt1-agent-listener.h b/agent/polkitqt1-agent-listener.h
index 07fe03a..a40ff41 100644
--- a/agent/polkitqt1-agent-listener.h
+++ b/agent/polkitqt1-agent-listener.h
@@ -9,6 +9,7 @@
 #define POLKITQT1_AGENT_LISTENER_H

 #include <QObject>
+#include <QScopedPointer>

 #include "polkitqt1-agent-session.h"

@@ -137,7 +138,7 @@ public Q_SLOTS:
     virtual void cancelAuthentication() = 0;

 private:
-    ListenerPrivate * const d;
+    QScopedPointer<ListenerPrivate> d;
 };
 }

--
GitLab