Merge pull request #236 from liskin/memleaks

fix a few memory leaks reported by valgrind
This commit is contained in:
yshui 2019-09-20 14:52:17 +00:00 committed by GitHub
commit 0063738754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -26,6 +26,7 @@ enum driver detect_driver(xcb_connection_t *c, backend_t *backend_data, xcb_wind
c, xcb_randr_get_providers(c, window), NULL);
if (r == NULL) {
log_warn("Failed to get RANDR providers");
free(randr_version);
return 0;
}
@ -58,9 +59,11 @@ enum driver detect_driver(xcb_connection_t *c, backend_t *backend_data, xcb_wind
ret |= DRIVER_INTEL;
}
free(name);
free(r2);
}
free(r);
}
free(randr_version);
// If the backend supports driver detection, use that as well
if (backend_data && backend_data->ops->detect_driver) {

View File

@ -1333,10 +1333,13 @@ static void handle_pending_updates(EV_P_ struct session *ps) {
// Call fill_win on new windows
handle_new_windows(ps);
{
auto r = xcb_get_input_focus_reply(ps->c, xcb_get_input_focus(ps->c), NULL);
if (!ps->active_win || (r && r->focus != ps->active_win->base.id)) {
recheck_focus(ps);
}
free(r);
}
// Process window updates
refresh_windows(ps);

View File

@ -1232,6 +1232,7 @@ struct win *fill_win(session_t *ps, struct win *w) {
if (a->_class == XCB_WINDOW_CLASS_INPUT_ONLY) {
// No need to manage this window, but we still keep it on the window stack
w->managed = false;
free(a);
return w;
}