diff --git a/argpopt.h b/argpopt.h index 9be6d2c..4ab2569 100644 --- a/argpopt.h +++ b/argpopt.h @@ -25,7 +25,7 @@ struct Config 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 = ""; static char doc[] = "Deamon that stops programms via SIGSTOP when their X11 windows lose focus."; static char args_doc[] = ""; diff --git a/debian/changelog b/debian/changelog index 80f8af4..c9fa8bc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,7 @@ +sigstoped (1.0.4) unstable; urgency=medium + Fix memory leak in XInstance::getTopLevelWindows() + -- Uvos Mon, 16 Jun 2020 09:47:00 +0100 + sigstoped (1.0.3) unstable; urgency=medium Ignore BadWindow errors caused by faulty __NET_ACTIVE_WINDOW events -- Uvos Mon, 15 Jun 2020 23:47:00 +0100 diff --git a/xinstance.cpp b/xinstance.cpp index 836eb64..c785a97 100644 --- a/xinstance.cpp +++ b/xinstance.cpp @@ -107,13 +107,13 @@ std::vector XInstance::getTopLevelWindows() Window* windows = nullptr; unsigned int nwindows; XQueryTree(display, RootWindow(display, screen), &root_return, &parent_return, &windows, &nwindows); - std::vector out; out.reserve(nwindows); - for(unsigned int i; i < nwindows; ++i) + for(unsigned int i = 0; i < nwindows; ++i) { out.push_back(windows[i]); } + if(windows != nullptr) XFree(windows); return out; }