From f33018188bf5bdf6f6b8af0d646e3f8c519d9d71 Mon Sep 17 00:00:00 2001 From: mwturvey Date: Thu, 23 Mar 2017 12:13:44 -0700 Subject: Added support for empty string in config.json & other cleanup. --- redist/json_helpers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'redist') 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; -- cgit v1.2.3