diff options
author | Michael Turvey <mwturvey@users.noreply.github.com> | 2017-03-25 21:57:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-25 21:57:41 -0700 |
commit | b795afd28b7f7e2c1b9ca3f01e9f5ffeb1c75be8 (patch) | |
tree | d7156b4742fa6a77c71c9deb46237c9b8ef1a670 /redist/json_helpers.c | |
parent | 5404526ae8da8c5fdff81b8ee8120ffe73647747 (diff) | |
parent | efe1b3e98866d45dd3bb5f8060712db152762edd (diff) | |
download | libsurvive-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.c | 5 |
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; |