[cpp] Closes #2622, fix memory leak in case of version mismatch.

This commit is contained in:
Mario Zechner 2024-09-09 11:20:49 +02:00
parent 0ffcc63b5e
commit 03826796b6

View File

@ -156,6 +156,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
if (!skeletonData->_version.startsWith(SPINE_VERSION_STRING)) {
char errorMsg[255];
snprintf(errorMsg, 255, "Skeleton version %s does not match runtime version %s", skeletonData->_version.buffer(), SPINE_VERSION_STRING);
delete skeletonData;
setError(NULL, errorMsg, "");
return NULL;
}