Bugfix: Some memory leaks / invalid accesses
This commit is contained in:
parent
17bca23a8c
commit
1343b77dbb
@ -323,7 +323,10 @@ static void move_current_window_to_workspace(xcb_connection_t *conn, int workspa
|
|||||||
assert(to_container != NULL);
|
assert(to_container != NULL);
|
||||||
|
|
||||||
CIRCLEQ_REMOVE(&(container->clients), current_client, clients);
|
CIRCLEQ_REMOVE(&(container->clients), current_client, clients);
|
||||||
|
SLIST_REMOVE(&(container->workspace->focus_stack), current_client, Client, focus_clients);
|
||||||
|
|
||||||
CIRCLEQ_INSERT_TAIL(&(to_container->clients), current_client, clients);
|
CIRCLEQ_INSERT_TAIL(&(to_container->clients), current_client, clients);
|
||||||
|
SLIST_INSERT_HEAD(&(to_container->workspace->focus_stack), current_client, focus_clients);
|
||||||
printf("Moved.\n");
|
printf("Moved.\n");
|
||||||
|
|
||||||
current_client->container = to_container;
|
current_client->container = to_container;
|
||||||
|
@ -418,6 +418,18 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Free the client’s colorpixel cache */
|
||||||
|
struct Colorpixel *colorpixel;
|
||||||
|
while (!SLIST_EMPTY(&(client->colorpixels))) {
|
||||||
|
colorpixel = SLIST_FIRST(&(client->colorpixels));
|
||||||
|
SLIST_REMOVE_HEAD(&(client->colorpixels), colorpixels);
|
||||||
|
free(colorpixel->hex);
|
||||||
|
free(colorpixel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (client->name != NULL)
|
||||||
|
free(client->name);
|
||||||
|
|
||||||
if (client->container != NULL) {
|
if (client->container != NULL) {
|
||||||
Container *con = client->container;
|
Container *con = client->container;
|
||||||
|
|
||||||
@ -474,8 +486,11 @@ int handle_windowname_change(void *data, xcb_connection_t *conn, uint8_t state,
|
|||||||
if (client == NULL)
|
if (client == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
if (client->name != NULL)
|
||||||
|
free(client->name);
|
||||||
|
|
||||||
client->name_len = xcb_get_property_value_length(prop);
|
client->name_len = xcb_get_property_value_length(prop);
|
||||||
client->name = malloc(client->name_len);
|
client->name = smalloc(client->name_len);
|
||||||
strncpy(client->name, xcb_get_property_value(prop), client->name_len);
|
strncpy(client->name, xcb_get_property_value(prop), client->name_len);
|
||||||
printf("rename to \"%.*s\".\n", client->name_len, client->name);
|
printf("rename to \"%.*s\".\n", client->name_len, client->name);
|
||||||
|
|
||||||
|
@ -280,6 +280,7 @@ void manage_existing_windows(xcb_connection_t *conn, xcb_property_handlers_t *pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(reply);
|
free(reply);
|
||||||
|
free(cookies);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[], char *env[]) {
|
int main(int argc, char *argv[], char *env[]) {
|
||||||
|
@ -165,12 +165,18 @@ void initialize_xinerama(xcb_connection_t *conn) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!xcb_xinerama_is_active_reply(conn, xcb_xinerama_is_active(conn), NULL)->state) {
|
xcb_xinerama_is_active_reply_t *reply;
|
||||||
|
reply = xcb_xinerama_is_active_reply(conn, xcb_xinerama_is_active(conn), NULL);
|
||||||
|
|
||||||
|
if (!reply->state) {
|
||||||
printf("Xinerama is not active (in your X-Server), disabling.\n");
|
printf("Xinerama is not active (in your X-Server), disabling.\n");
|
||||||
|
free(reply);
|
||||||
disable_xinerama(conn);
|
disable_xinerama(conn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(reply);
|
||||||
|
|
||||||
query_screens(conn, virtual_screens);
|
query_screens(conn, virtual_screens);
|
||||||
|
|
||||||
i3Screen *s;
|
i3Screen *s;
|
||||||
@ -253,7 +259,8 @@ void xinerama_requery_screens(xcb_connection_t *conn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Free the old list */
|
/* Free the old list */
|
||||||
TAILQ_FOREACH(screen, virtual_screens, screens) {
|
while (!TAILQ_EMPTY(virtual_screens)) {
|
||||||
|
screen = TAILQ_FIRST(virtual_screens);
|
||||||
TAILQ_REMOVE(virtual_screens, screen, screens);
|
TAILQ_REMOVE(virtual_screens, screen, screens);
|
||||||
free(screen);
|
free(screen);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user