diary

Text-based journaling program
git clone https://git.in0rdr.ch/diary.git
Log | Files | Refs | README | LICENSE

commit cd725931047ddaf5985d8002a5706d58f974a088
parent e1527e4c2bee60a2ebfed2e9011b2fa95774e229
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Tue,  1 Jun 2021 00:02:51 +0200

fix no json tok found

Diffstat:
Mutils.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/utils.c b/utils.c @@ -22,8 +22,12 @@ char* extract_json_value(const char* json, char* key, bool quoted) { tok = strtok(tok, ","); } - char* res = (char*) malloc(strlen(tok) * sizeof(char)); - strcpy(res, tok); + char* res = NULL; + if (tok != NULL) { + res = (char*) malloc(strlen(tok) * sizeof(char)); + strcpy(res, tok); + } + free(jsoncp); return res; }