commit 42ed58438e38bcf1546da93db1c64fd6cea411b5
parent 7a0f51c52433d74f86e017ff27b9b4c07195def1
Author: Bastien Dejean <nihilhill@gmail.com>
Date: Fri, 2 Aug 2013 11:19:09 +0200
Fix potential memory leak
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/types.c b/types.c
@@ -86,8 +86,10 @@ chord_t *make_chord(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfield,
for (chord_t *c = orig; unique && c != NULL; c = c->more)
if (c->modfield == explicit_modfield && c->keysym == natural_keysym)
unique = false;
- if (!unique)
+ if (!unique) {
+ free(chord);
break;
+ }
chord->keysym = natural_keysym;
chord->button = button;
chord->modfield = explicit_modfield;