summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/x11_util.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/x11_util.c b/src/x11_util.c
index f5f1c87..3662594 100644
--- a/src/x11_util.c
+++ b/src/x11_util.c
@@ -19,17 +19,14 @@ suil_x11_is_valid_child(Display* const display,
unsigned n_children = 0U;
XQueryTree(display, parent, &root, &grandparent, &children, &n_children);
-
- for (unsigned i = 0U; i < n_children; ++i) {
- if (children[i] == child) {
- if (children) {
+ if (children) {
+ for (unsigned i = 0U; i < n_children; ++i) {
+ if (children[i] == child) {
XFree(children);
+ return true;
}
- return true;
}
- }
- if (children) {
XFree(children);
}