aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop/layer_shell.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-07-17 08:46:53 -0700
committerGitHub <noreply@github.com>2018-07-17 08:46:53 -0700
commitbec982bba62db39f734d21ffbd2a3c8cefb3f6bd (patch)
treeaff37d623566b7fa85fcdaf78f8ae046fec8cde5 /sway/desktop/layer_shell.c
parentf516dbfb6d3380de24751de9a3f3156ece869e02 (diff)
parent3931cb85b220294764db959513ecadb893e2c47b (diff)
Merge pull request #2289 from frsfnrrg/memory-fixes
Fix memory leaks and reference to uninitialized
Diffstat (limited to 'sway/desktop/layer_shell.c')
-rw-r--r--sway/desktop/layer_shell.c12
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) {
layer_surface->client_pending.margin.bottom,
layer_surface->client_pending.margin.left);
- struct sway_layer_surface *sway_layer =
- calloc(1, sizeof(struct sway_layer_surface));
- if (!sway_layer) {
- return;
- }
-
if (!layer_surface->output) {
// Assign last active output
struct sway_container *output = NULL;
@@ -352,6 +346,12 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
layer_surface->output = output->sway_output->wlr_output;
}
+ struct sway_layer_surface *sway_layer =
+ calloc(1, sizeof(struct sway_layer_surface));
+ if (!sway_layer) {
+ return;
+ }
+
sway_layer->surface_commit.notify = handle_surface_commit;
wl_signal_add(&layer_surface->surface->events.commit,
&sway_layer->surface_commit);