From c5e6bd02660313b124f5470094ffc8d9341f77a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 26 Feb 2019 21:21:26 +0100 Subject: Fix memmory error. --- vcal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vcal.c') diff --git a/vcal.c b/vcal.c index 61d6fbb8..e93750ee 100644 --- a/vcal.c +++ b/vcal.c @@ -115,7 +115,7 @@ int vcomponent_push_val (vcomponent* comp, const char* key, const char* val) { strbuf_load(&cs->key, val); PUSH(content_line)(cl, cs); - char* key_cpy = calloc(sizeof(*key_cpy), strlen(key)); + char* key_cpy = calloc(sizeof(*key_cpy), strlen(key) + 1); strcpy (key_cpy, key); PUSH(TRIE(content_line))(&comp->clines, key_cpy, cl); free (key_cpy); @@ -124,7 +124,7 @@ int vcomponent_push_val (vcomponent* comp, const char* key, const char* val) { } char* vcomponent_get_val (vcomponent* comp, const char* key) { - char* key_cpy = calloc(sizeof(*key_cpy), strlen(key)); + char* key_cpy = calloc(sizeof(*key_cpy), strlen(key) + 1); strcpy (key_cpy, key); content_line* cl = GET(TRIE(content_line))(&comp->clines, key_cpy); free (key_cpy); -- cgit v1.2.3