From 39efa6eb18ca90be67c00bcc10f9060f0ad0b66e Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 22 Jun 2009 17:18:06 +0200 Subject: [PATCH] client: fix key array leak Signed-off-by: Julien Danjou --- client.c | 1 + key.c | 3 +-- key.h | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client.c b/client.c index 2ad09059e..f1a41926b 100644 --- a/client.c +++ b/client.c @@ -52,6 +52,7 @@ luaA_client_gc(lua_State *L) { client_t *c = luaL_checkudata(L, 1, "client"); button_array_wipe(&c->buttons); + key_array_wipe(&c->keys); image_unref(L, c->icon); p_delete(&c->class); p_delete(&c->startup_id); diff --git a/key.c b/key.c index 8b84a1395..f30d33279 100644 --- a/key.c +++ b/key.c @@ -33,13 +33,12 @@ LUA_OBJECT_FUNCS(keyb_t, key, "key") -static void +void key_unref_simplified(keyb_t **b) { key_unref(globalconf.L, *b); } -ARRAY_FUNCS(keyb_t *, key, key_unref_simplified) DO_LUA_TOSTRING(keyb_t, key, "key") /** Garbage collect a key. diff --git a/key.h b/key.h index f5d987d06..972f77ec9 100644 --- a/key.h +++ b/key.h @@ -39,7 +39,9 @@ typedef struct keyb_t luaA_ref release; } keyb_t; -ARRAY_TYPE(keyb_t *, key) +void key_unref_simplified(keyb_t **); + +DO_ARRAY(keyb_t *, key, key_unref_simplified) bool key_press_lookup_string(xcb_keysym_t, char *, ssize_t); xcb_keysym_t key_getkeysym(xcb_keycode_t, uint16_t);