Skip to content

Commit

Permalink
[Window] write code so clang-check does not complain about leak.
Browse files Browse the repository at this point in the history
Does not solve the possible, but very unlikely leak, but keeps
clang-check happy.
  • Loading branch information
DaveDavenport committed Feb 28, 2024
1 parent afc65ac commit 42d6bb9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions source/modes/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static winlist *winlist_new(void) {
*
* Add one entry. If Full, extend with WINLIST entries.
*
* @returns 0 if failed, 1 is successful.
* @returns -1 if failed, 0 or higher is successful.
*/
static int winlist_append(winlist *l, xcb_window_t w, client *d) {
if (l->len > 0 && !(l->len % WINLIST)) {
Expand All @@ -187,7 +187,7 @@ static int winlist_append(winlist *l, xcb_window_t w, client *d) {
// Make clang-check happy.
// TODO: make clang-check clear this should never be 0.
if (l->data == NULL || l->array == NULL) {
return 0;
return -1;
}

l->data[l->len] = d;
Expand Down Expand Up @@ -386,7 +386,13 @@ static client *window_client(WindowModePrivateData *pd, xcb_window_t win) {
c->hint_flags = r.flags;
}

winlist_append(cache_client, c->window, c);
idx = winlist_append(cache_client, c->window, c);
// Should never happen.
if (idx < 0) {
client_free(c);
g_free(c);
c = NULL;
}
g_free(attr);
return c;
}
Expand Down

0 comments on commit 42d6bb9

Please sign in to comment.