aboutsummaryrefslogtreecommitdiff
path: root/redist/json_helpers.c
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2017-04-04 23:19:03 -0400
committercnlohr <lohr85@gmail.com>2017-04-04 23:19:03 -0400
commit5882e34cf7c6c9705ba0fd94cfb6e6072ceb8f63 (patch)
treeb975cc4276fa938b5295e4cc97f49142bf968a3f /redist/json_helpers.c
parented6f9dc1a9247581f13ecc6943823e04f0dcd4ca (diff)
parentc68aebf34e1342560a3f8f52cb65e72eb2fa7b54 (diff)
downloadlibsurvive-5882e34cf7c6c9705ba0fd94cfb6e6072ceb8f63.tar.gz
libsurvive-5882e34cf7c6c9705ba0fd94cfb6e6072ceb8f63.tar.bz2
Merge branch 'master' of https://github.com/cnlohr/libsurvive
Diffstat (limited to 'redist/json_helpers.c')
-rw-r--r--redist/json_helpers.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/redist/json_helpers.c b/redist/json_helpers.c
index 0267932..29d48bd 100644
--- a/redist/json_helpers.c
+++ b/redist/json_helpers.c
@@ -117,7 +117,8 @@ char* load_file_to_mem(const char* path) {
fseek( f, 0, SEEK_END );
int len = ftell( f );
fseek( f, 0, SEEK_SET );
- char * JSON_STRING = malloc( len );
+ char * JSON_STRING = malloc( len + 1);
+ memset(JSON_STRING,0,len+1);
fread( JSON_STRING, len, 1, f );
fclose( f );
return JSON_STRING;
@@ -173,7 +174,7 @@ void json_load_file(const char* path) {
int16_t children = -1;
- for (i=0; i<(int)items; i+=2)
+ for (i=0; i<(unsigned int)items; i+=2)
{
//increment i on each successful tag + values combination, not individual tokens
jsmntok_t* tag_t = tokens+i;