Skip to content

Commit

Permalink
Merge pull request yshui#236 from liskin/memleaks
Browse files Browse the repository at this point in the history
fix a few memory leaks reported by valgrind
  • Loading branch information
yshui authored Sep 20, 2019
2 parents b38a5ae + 23421b2 commit 0063738
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/backend/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 6 additions & 3 deletions src/compton.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,9 +1333,12 @@ 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);
{
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
Expand Down
1 change: 1 addition & 0 deletions src/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 0063738

Please sign in to comment.