From 82d94338137ef54123798fcca18da7131b31fec7 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 16 Jan 2022 20:50:56 +0100 Subject: [PATCH] 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. --- json_object.c | 1 + 1 file changed, 1 insertion(+) 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 ... -- 2.39.5