[PATCH weston] compositor-wayland: fix leak in create_cursor when theme load fails
U. Artie Eoff
ullysses.a.eoff at intel.com
Wed May 7 11:31:20 PDT 2014
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.eoff at 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
More information about the wayland-devel
mailing list