From 88b4d2ba7939e8afd7bd5a6e32548c613c2f7ae0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 16 Nov 2017 00:58:06 +0200 Subject: [PATCH] Test --- crypto777/cJSON.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crypto777/cJSON.c b/crypto777/cJSON.c index 4c0777656..d6c43f2fa 100755 --- a/crypto777/cJSON.c +++ b/crypto777/cJSON.c @@ -829,7 +829,7 @@ char *jstr(cJSON *json,char *field) { if ( json == 0 ) return(0); if ( field == char *jstri(cJSON *json,int32_t i) { return(cJSON_str(cJSON_GetArrayItem(json,i))); } char *jprint(cJSON *json,int32_t freeflag) { - char *str; + char *str,*retstr; /*static portable_mutex_t mutex; static int32_t initflag; if ( initflag == 0 ) { @@ -843,8 +843,11 @@ char *jprint(cJSON *json,int32_t freeflag) str = cJSON_Print(json), _stripwhite(str,' '); if ( freeflag != 0 ) free_json(json); + retstr = malloc(strlen(str) + 1); + strcpy(retstr,str); + cJSON_free(str); //portable_mutex_unlock(&mutex); - return(str); + return(retstr); } bits256 get_API_bits256(cJSON *obj)