aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-27 17:47:41 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-27 17:47:41 +1000
commit8773ed39701748ba5500b4698d028795aa6e812e (patch)
tree171f771887ad7bba4cb454031451ae37ebdbae13
parentRemove transaction_add_damage (diff)
downloadsway-8773ed39701748ba5500b4698d028795aa6e812e.tar.gz
sway-8773ed39701748ba5500b4698d028795aa6e812e.tar.zst
sway-8773ed39701748ba5500b4698d028795aa6e812e.zip
Fix memleak in container_get_box
Rather than allocate a structure and expect callers to free it, take a pointer to an existing struct as an argument. This function is no longer called anywhere though.
-rw-r--r--include/sway/tree/container.h2
-rw-r--r--sway/tree/container.c4
2 files changed, 2 insertions, 4 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index 7e78cbef..728daa84 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -295,6 +295,6 @@ bool container_is_floating(struct sway_container *container);
295/** 295/**
296 * Get a container's box in layout coordinates. 296 * Get a container's box in layout coordinates.
297 */ 297 */
298struct wlr_box *container_get_box(struct sway_container *container); 298void container_get_box(struct sway_container *container, struct wlr_box *box);
299 299
300#endif 300#endif
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 8446c457..ab3d9dbd 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -988,11 +988,9 @@ bool container_is_floating(struct sway_container *container) {
988 return container->parent == workspace->sway_workspace->floating; 988 return container->parent == workspace->sway_workspace->floating;
989} 989}
990 990
991struct wlr_box *container_get_box(struct sway_container *container) { 991void container_get_box(struct sway_container *container, struct wlr_box *box) {
992 struct wlr_box *box = calloc(1, sizeof(struct wlr_box));
993 box->x = container->x; 992 box->x = container->x;
994 box->y = container->y; 993 box->y = container->y;
995 box->width = container->width; 994 box->width = container->width;
996 box->height = container->height; 995 box->height = container->height;
997 return box;
998} 996}