summary refs log tree commit diff
path: root/src/voip/CallDevices.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-01-22 05:01:50 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2023-01-22 05:02:10 +0100
commit7f9af9016d2e5a5513457e191bc454885561a73a (patch)
tree6e02e5961341868bc32b5dab4cbd8a612e426919 /src/voip/CallDevices.cpp
parentMerge pull request #1304 from Decodetalkers/imagesave (diff)
downloadnheko-7f9af9016d2e5a5513457e191bc454885561a73a.tar.xz
Fix a few minor leaks (or just memory showing up as not freed in tools)
Diffstat (limited to 'src/voip/CallDevices.cpp')
-rw-r--r--src/voip/CallDevices.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/voip/CallDevices.cpp b/src/voip/CallDevices.cpp
index e47b5960..ee9a7f43 100644
--- a/src/voip/CallDevices.cpp
+++ b/src/voip/CallDevices.cpp
@@ -248,10 +248,11 @@ tokenise(std::string_view str, char delim)
 }
 }
 
+static GstDeviceMonitor *monitor = nullptr;
+
 void
 CallDevices::init()
 {
-    static GstDeviceMonitor *monitor = nullptr;
     if (!monitor) {
         monitor       = gst_device_monitor_new();
         GstCaps *caps = gst_caps_new_empty_simple("audio/x-raw");
@@ -273,6 +274,16 @@ CallDevices::init()
     }
 }
 
+void
+CallDevices::deinit()
+{
+    if (monitor) {
+        gst_device_monitor_stop(monitor);
+        g_free(monitor);
+        monitor = nullptr;
+    }
+}
+
 bool
 CallDevices::haveMic() const
 {