summaryrefslogtreecommitdiff
path: root/i3lock.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2012-01-03 21:01:05 +0000
committerMichael Stapelberg <michael@stapelberg.de>2012-01-03 21:01:05 +0000
commit6ea3fbdc213e7b9503cc6645e6fbc56c305166b9 (patch)
treed7462805edb708888c73246f9a65fa72ffb4ad63 /i3lock.c
parent57585bef70d82b82b8f5a4b1a7eed2d2db7fa8c9 (diff)
Properly free the reply of xcb_get_geometry
Diffstat (limited to 'i3lock.c')
-rw-r--r--i3lock.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/i3lock.c b/i3lock.c
index 8a365f3..b694f6e 100644
--- a/i3lock.c
+++ b/i3lock.c
@@ -391,20 +391,24 @@ static void handle_mapping_notify(xcb_mapping_notify_event_t *event) {
* and also redraw the image, if any.
*
*/
-void handle_screen_resize(xcb_window_t win, uint32_t* last_resolution) {
+void handle_screen_resize() {
xcb_get_geometry_cookie_t geomc;
xcb_get_geometry_reply_t *geom;
geomc = xcb_get_geometry(conn, screen->root);
- if ((geom = xcb_get_geometry_reply(conn, geomc, 0)) == NULL) {
- return;
- }
+ if ((geom = xcb_get_geometry_reply(conn, geomc, 0)) == NULL)
+ return;
- if (last_resolution[0] == geom->width && last_resolution[1] == geom->height)
- return;
+ if (last_resolution[0] == geom->width &&
+ last_resolution[1] == geom->height) {
+ free(geom);
+ return;
+ }
last_resolution[0] = geom->width;
last_resolution[1] = geom->height;
+ free(geom);
+
#ifndef NOLIBCAIRO
redraw_screen();
#endif
@@ -523,7 +527,7 @@ static void xcb_check_cb(EV_P_ ev_check *w, int revents) {
}
if (type == XCB_CONFIGURE_NOTIFY) {
- handle_screen_resize(win, last_resolution);
+ handle_screen_resize();
continue;
}