From: Even Rouault Date: Sun, 16 Jan 2022 19:50:56 +0000 (+0100) Subject: json_object_copy_serializer_data(): add assertion X-Git-Tag: json-c-0.16-20220414~21^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F742%2Fhead;p=thirdparty%2Fjson-c.git json_object_copy_serializer_data(): add assertion This makes Coverity Scan happier since it believes that the initial check ``if (!src->_userdata && !src->_user_delete)`` could mean that src->_user_data may be nullptr. --- diff --git a/json_object.c b/json_object.c index d59a317e..2b392dcd 100644 --- a/json_object.c +++ b/json_object.c @@ -1588,6 +1588,7 @@ static int json_object_copy_serializer_data(struct json_object *src, struct json if (dst->_to_json_string == json_object_userdata_to_json_string || dst->_to_json_string == _json_object_userdata_to_json_string) { + assert(src->_userdata); dst->_userdata = strdup(src->_userdata); } // else if ... other supported serializers ...