diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-19 15:32:50 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-19 15:32:50 -0600 |
commit | 3767b1088890959147b8d3e0dbf63e472f2fac96 (patch) | |
tree | eb795632f5402db9b089fd3a8c1185725b02001a /ui | |
parent | d37840b32f0baaf497fc3c5bdf8dcf7210332a76 (diff) | |
download | horizon-3767b1088890959147b8d3e0dbf63e472f2fac96.tar.gz horizon-3767b1088890959147b8d3e0dbf63e472f2fac96.tar.bz2 horizon-3767b1088890959147b8d3e0dbf63e472f2fac96.tar.xz horizon-3767b1088890959147b8d3e0dbf63e472f2fac96.zip |
Qt UI: Fix small memory leak issues
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt5/datetimepage.cc | 8 | ||||
-rw-r--r-- | ui/qt5/inputpage.cc | 6 | ||||
-rw-r--r-- | ui/qt5/netsimplewifipage.cc | 3 |
3 files changed, 14 insertions, 3 deletions
diff --git a/ui/qt5/datetimepage.cc b/ui/qt5/datetimepage.cc index a333c15..f3e2ad2 100644 --- a/ui/qt5/datetimepage.cc +++ b/ui/qt5/datetimepage.cc @@ -114,11 +114,15 @@ void DateTimePage::maybeRaiseCap() { if(captain == nullptr) return; - if(cap_set_flag(captain, CAP_EFFECTIVE, 1, &time_cap, CAP_SET) == -1) + if(cap_set_flag(captain, CAP_EFFECTIVE, 1, &time_cap, CAP_SET) == -1) { + cap_free(captain); return; + } - if(cap_set_proc(captain)) + if(cap_set_proc(captain)) { + cap_free(captain); return; + } cap_free(captain); diff --git a/ui/qt5/inputpage.cc b/ui/qt5/inputpage.cc index 2807c02..4717300 100644 --- a/ui/qt5/inputpage.cc +++ b/ui/qt5/inputpage.cc @@ -91,10 +91,14 @@ void InputPage::initializePage() { /* Select the current keyboard layout, if available. */ Display *dpy = XOpenDisplay(nullptr); if(dpy != nullptr) { - XkbRF_VarDefsRec vardefs; + XkbRF_VarDefsRec vardefs{}; XkbRF_GetNamesProp(dpy, nullptr, &vardefs); QList<QListWidgetItem *> items = layoutList->findItems(vardefs.layout, Qt::MatchExactly); if(!items.empty()) layoutList->setCurrentItem(items.at(0)); + free(vardefs.model); + free(vardefs.layout); + free(vardefs.variant); + free(vardefs.options); XCloseDisplay(dpy); } #endif /* HAS_INSTALL_ENV */ diff --git a/ui/qt5/netsimplewifipage.cc b/ui/qt5/netsimplewifipage.cc index 3f61cb9..a1e6139 100644 --- a/ui/qt5/netsimplewifipage.cc +++ b/ui/qt5/netsimplewifipage.cc @@ -286,6 +286,9 @@ int NetworkSimpleWirelessPage::processScan(wpactrl_t *c, const char *, size_t) { ssidListView->addItem(item); } + stralloc_free(&netstr); + genalloc_free(wpactrl_scanres_t, &nets); + return 1; } #endif /* HAS_INSTALL_ENV */ |