diff options
author | frsfnrrg <frsfnrrg@users.noreply.github.com> | 2018-07-17 11:21:32 -0400 |
---|---|---|
committer | frsfnrrg <frsfnrrg@users.noreply.github.com> | 2018-07-17 11:35:24 -0400 |
commit | 37471ac649cf594975b4e0ab09291c116c66feec (patch) | |
tree | 0bfa857dd6b944ad1f3c34b241b39559f42979b2 | |
parent | Free individual criteria in free_config (diff) | |
download | sway-37471ac649cf594975b4e0ab09291c116c66feec.tar.gz sway-37471ac649cf594975b4e0ab09291c116c66feec.tar.zst sway-37471ac649cf594975b4e0ab09291c116c66feec.zip |
Fix memory leak in handle_layer_shell_surface
-rw-r--r-- | sway/desktop/layer_shell.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 91baa6f8..a7d96717 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -325,12 +325,6 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { | |||
325 | layer_surface->client_pending.margin.bottom, | 325 | layer_surface->client_pending.margin.bottom, |
326 | layer_surface->client_pending.margin.left); | 326 | layer_surface->client_pending.margin.left); |
327 | 327 | ||
328 | struct sway_layer_surface *sway_layer = | ||
329 | calloc(1, sizeof(struct sway_layer_surface)); | ||
330 | if (!sway_layer) { | ||
331 | return; | ||
332 | } | ||
333 | |||
334 | if (!layer_surface->output) { | 328 | if (!layer_surface->output) { |
335 | // Assign last active output | 329 | // Assign last active output |
336 | struct sway_container *output = NULL; | 330 | struct sway_container *output = NULL; |
@@ -352,6 +346,12 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { | |||
352 | layer_surface->output = output->sway_output->wlr_output; | 346 | layer_surface->output = output->sway_output->wlr_output; |
353 | } | 347 | } |
354 | 348 | ||
349 | struct sway_layer_surface *sway_layer = | ||
350 | calloc(1, sizeof(struct sway_layer_surface)); | ||
351 | if (!sway_layer) { | ||
352 | return; | ||
353 | } | ||
354 | |||
355 | sway_layer->surface_commit.notify = handle_surface_commit; | 355 | sway_layer->surface_commit.notify = handle_surface_commit; |
356 | wl_signal_add(&layer_surface->surface->events.commit, | 356 | wl_signal_add(&layer_surface->surface->events.commit, |
357 | &sway_layer->surface_commit); | 357 | &sway_layer->surface_commit); |