X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=json.h;fp=json.h;h=d98242638d4a186b13fa6ba2da86639454dc47b8;hp=1544ed765055f9c0e4aabb207b80dd0536bc43ec;hb=c42b48fed60105b4bcd443b9a013548e9e9c43e0;hpb=d51e4ffa596b617cdb41680b31a4a3895a5307fc diff --git a/json.h b/json.h index 1544ed76..d9824263 100644 --- a/json.h +++ b/json.h @@ -82,7 +82,7 @@ static inline int json_object_add_value_string(struct json_object *obj, .type = JSON_TYPE_STRING, }; - arg.string = (char *)val; + arg.string = strdup(val ? : ""); return json_object_add_value_type(obj, name, &arg); }