aboutsummaryrefslogtreecommitdiff
path: root/redist/json_helpers.c
diff options
context:
space:
mode:
authorMichael Turvey <mwturvey@users.noreply.github.com>2017-03-25 21:57:41 -0700
committerGitHub <noreply@github.com>2017-03-25 21:57:41 -0700
commitb795afd28b7f7e2c1b9ca3f01e9f5ffeb1c75be8 (patch)
treed7156b4742fa6a77c71c9deb46237c9b8ef1a670 /redist/json_helpers.c
parent5404526ae8da8c5fdff81b8ee8120ffe73647747 (diff)
parentefe1b3e98866d45dd3bb5f8060712db152762edd (diff)
downloadlibsurvive-b795afd28b7f7e2c1b9ca3f01e9f5ffeb1c75be8.tar.gz
libsurvive-b795afd28b7f7e2c1b9ca3f01e9f5ffeb1c75be8.tar.bz2
Merge pull request #43 from mwturvey/alternate_disambiguator
Alternate disambiguator
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;