summaryrefslogtreecommitdiff
path: root/src/hook.c
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2013-08-08 02:20:40 +0200
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2013-08-08 02:20:40 +0200
commitdedcb4677b67737a781c300d06de1022201f709b (patch)
treeef5987402fc654abbaa24fce6c3e91044fb3df9b /src/hook.c
parentb02d855fbdab5849db59f0edd9cc5e6038d9aae2 (diff)
downloadratpoison-dedcb4677b67737a781c300d06de1022201f709b.zip
Do not leak mem if hook is already present.
From Repolho <repolho at zoho dot com>, thanks!
Diffstat (limited to 'src/hook.c')
-rw-r--r--src/hook.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/hook.c b/src/hook.c
index 3ff4751..5496104 100644
--- a/src/hook.c
+++ b/src/hook.c
@@ -34,7 +34,10 @@ hook_add (struct list_head *hook, struct sbuf *s)
list_for_each_entry (cur, hook, node)
{
if (!strcmp (sbuf_get (cur), sbuf_get (s)))
- return;
+ {
+ sbuf_free (s);
+ return;
+ }
}
/* It's not in the list, so add it. */