aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2019-08-15 00:40:19 +0100
committerHarry Jeffery <harry@exec64.co.uk>2019-08-15 00:40:19 +0100
commit48aa31c7a10798956b4cf664cba79e1a5619c977 (patch)
treeac63a53e22c8e6bc8e1cf7abc5b68c8e8b447905
parent4db590c0d02bce840f6ff87031aeed6f24cc06d5 (diff)
downloadimv-48aa31c7a10798956b4cf664cba79e1a5619c977.tar.gz
binds: Fix memory leak
-rw-r--r--src/binds.c2
-rw-r--r--src/imv.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/binds.c b/src/binds.c
index 07416cf..e6aea45 100644
--- a/src/binds.c
+++ b/src/binds.c
@@ -86,7 +86,7 @@ enum bind_result imv_binds_add(struct imv_binds *binds, const struct list *keys,
/* Create our new node */
next_node = malloc(sizeof *next_node);
init_bind_node(next_node);
- next_node->key = keys->items[i];
+ next_node->key = strdup(keys->items[i]);
list_append(node->suffixes, next_node);
} else {
next_node = node->suffixes->items[child_index];
diff --git a/src/imv.c b/src/imv.c
index d5c2c3c..27f0d6d 100644
--- a/src/imv.c
+++ b/src/imv.c
@@ -286,7 +286,7 @@ static bool add_bind(struct imv *imv, const char *keys, const char *commands)
commands = next_command;
}
- list_free(list);
+ list_deep_free(list);
return success;
}