diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-26 21:21:26 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-26 21:21:26 +0100 |
commit | c5e6bd02660313b124f5470094ffc8d9341f77a6 (patch) | |
tree | 34f75cbde0497b3319074de38037001552701d9a /vcal.c | |
parent | Move stuff between code.scm and main.scm. (diff) | |
download | calp-c5e6bd02660313b124f5470094ffc8d9341f77a6.tar.gz calp-c5e6bd02660313b124f5470094ffc8d9341f77a6.tar.xz |
Fix memmory error.
Diffstat (limited to 'vcal.c')
-rw-r--r-- | vcal.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); |