aboutsummaryrefslogtreecommitdiff
path: root/vcal.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-26 21:21:26 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-26 21:21:26 +0100
commitc5e6bd02660313b124f5470094ffc8d9341f77a6 (patch)
tree34f75cbde0497b3319074de38037001552701d9a /vcal.c
parentMove stuff between code.scm and main.scm. (diff)
downloadcalp-c5e6bd02660313b124f5470094ffc8d9341f77a6.tar.gz
calp-c5e6bd02660313b124f5470094ffc8d9341f77a6.tar.xz
Fix memmory error.
Diffstat (limited to 'vcal.c')
-rw-r--r--vcal.c4
1 files changed, 2 insertions, 2 deletions
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);