mirror of
https://github.com/vale981/bspwm
synced 2025-03-05 18:01:37 -05:00
Fix memory leaks
This commit is contained in:
parent
5a98b655ec
commit
ea4b095276
2 changed files with 10 additions and 9 deletions
|
@ -212,8 +212,10 @@ void grab_pointer(pointer_action_t pac)
|
|||
xcb_grab_pointer_reply_t *reply = xcb_grab_pointer_reply(dpy, xcb_grab_pointer(dpy, 0, root, XCB_EVENT_MASK_BUTTON_RELEASE|XCB_EVENT_MASK_BUTTON_MOTION, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_NONE, XCB_NONE, XCB_CURRENT_TIME), NULL);
|
||||
|
||||
if (reply == NULL || reply->status != XCB_GRAB_STATUS_SUCCESS) {
|
||||
free(reply);
|
||||
return;
|
||||
}
|
||||
free(reply);
|
||||
|
||||
track_pointer(loc, pac, pos);
|
||||
}
|
||||
|
@ -260,6 +262,7 @@ void track_pointer(coordinates_t loc, pointer_action_t pac, xcb_point_t pos)
|
|||
handle_event(evt);
|
||||
}
|
||||
} while (grabbing && grabbed_node != NULL);
|
||||
free(evt);
|
||||
|
||||
xcb_ungrab_pointer(dpy, XCB_CURRENT_TIME);
|
||||
|
||||
|
|
16
window.c
16
window.c
|
@ -443,17 +443,15 @@ void initialize_floating_rectangle(node_t *n)
|
|||
xcb_rectangle_t get_window_rectangle(node_t *n)
|
||||
{
|
||||
client_t *c = n->client;
|
||||
xcb_get_geometry_reply_t *g = NULL;
|
||||
if (c != NULL) {
|
||||
g = xcb_get_geometry_reply(dpy, xcb_get_geometry(dpy, n->id), NULL);
|
||||
}
|
||||
if (g != NULL) {
|
||||
xcb_rectangle_t rect = (xcb_rectangle_t) {g->x, g->y, g->width, g->height};
|
||||
free(g);
|
||||
return rect;
|
||||
} else {
|
||||
return (xcb_rectangle_t) {0, 0, screen_width, screen_height};
|
||||
xcb_get_geometry_reply_t *g = xcb_get_geometry_reply(dpy, xcb_get_geometry(dpy, n->id), NULL);
|
||||
if (g != NULL) {
|
||||
xcb_rectangle_t rect = (xcb_rectangle_t) {g->x, g->y, g->width, g->height};
|
||||
free(g);
|
||||
return rect;
|
||||
}
|
||||
}
|
||||
return (xcb_rectangle_t) {0, 0, screen_width, screen_height};
|
||||
}
|
||||
|
||||
bool move_client(coordinates_t *loc, int dx, int dy)
|
||||
|
|
Loading…
Add table
Reference in a new issue