diff --git a/gear-lib/libconfig/json/json_config.c b/gear-lib/libconfig/json/json_config.c index 5a756b4483a8bc5efd60b4b3fbdf9408037fa428..9c652362d0356ff245e0befe8127fc8aba1c860e 100644 --- a/gear-lib/libconfig/json/json_config.c +++ b/gear-lib/libconfig/json/json_config.c @@ -33,7 +33,7 @@ static int read_file(const char *name, void **buf, size_t *len) char *tmp = NULL; size_t ret = 0; - fp = fopen(name, "r+"); + fp = fopen(name, "rb"); if (fp == NULL) { goto cleanup; } @@ -98,7 +98,7 @@ static int js_load(struct config *c, const char *name) { cJSON *json; size_t len; - void *buf; + void *buf = NULL; read_file(name, &buf, &len); if (!buf) { printf("read_file %s failed!\n", name);