Fix memory leak in XInstance::getTopLevelWindows

This commit is contained in:
2020-06-16 09:54:22 +02:00
parent bdcd27eb95
commit 8c69a02e5d
3 changed files with 7 additions and 3 deletions

View File

@ -25,7 +25,7 @@ struct Config
bool ignoreClientMachine = false; bool ignoreClientMachine = false;
}; };
const char *argp_program_version = "1.0.3"; const char *argp_program_version = "1.0.4";
const char *argp_program_bug_address = "<carl@uvos.xyz>"; const char *argp_program_bug_address = "<carl@uvos.xyz>";
static char doc[] = "Deamon that stops programms via SIGSTOP when their X11 windows lose focus."; static char doc[] = "Deamon that stops programms via SIGSTOP when their X11 windows lose focus.";
static char args_doc[] = ""; static char args_doc[] = "";

4
debian/changelog vendored
View File

@ -1,3 +1,7 @@
sigstoped (1.0.4) unstable; urgency=medium
Fix memory leak in XInstance::getTopLevelWindows()
-- Uvos <carl@uvos.xyz> Mon, 16 Jun 2020 09:47:00 +0100
sigstoped (1.0.3) unstable; urgency=medium sigstoped (1.0.3) unstable; urgency=medium
Ignore BadWindow errors caused by faulty __NET_ACTIVE_WINDOW events Ignore BadWindow errors caused by faulty __NET_ACTIVE_WINDOW events
-- Uvos <carl@uvos.xyz> Mon, 15 Jun 2020 23:47:00 +0100 -- Uvos <carl@uvos.xyz> Mon, 15 Jun 2020 23:47:00 +0100

View File

@ -107,13 +107,13 @@ std::vector<Window> XInstance::getTopLevelWindows()
Window* windows = nullptr; Window* windows = nullptr;
unsigned int nwindows; unsigned int nwindows;
XQueryTree(display, RootWindow(display, screen), &root_return, &parent_return, &windows, &nwindows); XQueryTree(display, RootWindow(display, screen), &root_return, &parent_return, &windows, &nwindows);
std::vector<Window> out; std::vector<Window> out;
out.reserve(nwindows); out.reserve(nwindows);
for(unsigned int i; i < nwindows; ++i) for(unsigned int i = 0; i < nwindows; ++i)
{ {
out.push_back(windows[i]); out.push_back(windows[i]);
} }
if(windows != nullptr) XFree(windows);
return out; return out;
} }