diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-01-22 05:01:50 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-01-22 05:02:10 +0100 |
commit | 7f9af9016d2e5a5513457e191bc454885561a73a (patch) | |
tree | 6e02e5961341868bc32b5dab4cbd8a612e426919 /src/voip | |
parent | Merge pull request #1304 from Decodetalkers/imagesave (diff) | |
download | nheko-7f9af9016d2e5a5513457e191bc454885561a73a.tar.xz |
Fix a few minor leaks (or just memory showing up as not freed in tools)
Diffstat (limited to 'src/voip')
-rw-r--r-- | src/voip/CallDevices.cpp | 13 | ||||
-rw-r--r-- | src/voip/CallDevices.h | 1 |
2 files changed, 13 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 { diff --git a/src/voip/CallDevices.h b/src/voip/CallDevices.h index 951f1ab2..d18ccfb3 100644 --- a/src/voip/CallDevices.h +++ b/src/voip/CallDevices.h @@ -46,4 +46,5 @@ private: public: CallDevices(CallDevices const &) = delete; void operator=(CallDevices const &) = delete; + void deinit(); }; |