Free the theme configuration string right after wl_cursor_load_theme
since we're done using it.  This fixes a leak when the cursor theme
could not be loaded.

Signed-off-by: U. Artie Eoff <ullysses.a.e...@intel.com>
---
 src/compositor-wayland.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index a08b71a..f7ccded 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -1869,13 +1869,13 @@ create_cursor(struct wayland_compositor *c, struct 
weston_config *config)
        weston_config_section_get_int(s, "cursor-size", &size, 32);
 
        c->cursor_theme = wl_cursor_theme_load(theme, size, c->parent.shm);
+       free(theme);
+
        if (!c->cursor_theme) {
                fprintf(stderr, "could not load cursor theme\n");
                return;
        }
 
-       free(theme);
-
        c->cursor = NULL;
        for (i = 0; !c->cursor && i < ARRAY_LENGTH(left_ptrs); ++i)
                c->cursor = wl_cursor_theme_get_cursor(c->cursor_theme,
-- 
1.9.0

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to