diff options
author | mwturvey <michael.w.turvey@intel.com> | 2017-03-23 12:13:44 -0700 |
---|---|---|
committer | mwturvey <michael.w.turvey@intel.com> | 2017-03-23 12:13:44 -0700 |
commit | f33018188bf5bdf6f6b8af0d646e3f8c519d9d71 (patch) | |
tree | b94e358bcf65076fb533cd26efdc95fe21753102 /redist | |
parent | 78b7b6fb520c287caecbe895501898ef5c1440a5 (diff) | |
download | libsurvive-f33018188bf5bdf6f6b8af0d646e3f8c519d9d71.tar.gz libsurvive-f33018188bf5bdf6f6b8af0d646e3f8c519d9d71.tar.bz2 |
Added support for empty string in config.json & other cleanup.
Diffstat (limited to 'redist')
-rw-r--r-- | redist/json_helpers.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/redist/json_helpers.c b/redist/json_helpers.c index 0267932..3b5cc0d 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; |