浏览代码

[rmodels] Fix leaks in LoadIQM() and LoadModelAnimationsIQM() (#4649)

Add calls to UnloadFileData() before return in cases of invalid IQM file.
pull/4652/head
Peter Zmanovsky 2 周前
committed by GitHub
父节点
当前提交
d1315e8a04
找不到此签名对应的密钥 GPG 密钥 ID: B5690EEEBB952194
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. +4
    -0
      src/rmodels.c

+ 4
- 0
src/rmodels.c 查看文件

@ -4570,12 +4570,14 @@ static Model LoadIQM(const char *fileName)
if (memcmp(iqmHeader->magic, IQM_MAGIC, sizeof(IQM_MAGIC)) != 0)
{
TRACELOG(LOG_WARNING, "MODEL: [%s] IQM file is not a valid model", fileName);
UnloadFileData(fileData);
return model;
}
if (iqmHeader->version != IQM_VERSION)
{
TRACELOG(LOG_WARNING, "MODEL: [%s] IQM file version not supported (%i)", fileName, iqmHeader->version);
UnloadFileData(fileData);
return model;
}
@ -4891,12 +4893,14 @@ static ModelAnimation *LoadModelAnimationsIQM(const char *fileName, int *animCou
if (memcmp(iqmHeader->magic, IQM_MAGIC, sizeof(IQM_MAGIC)) != 0)
{
TRACELOG(LOG_WARNING, "MODEL: [%s] IQM file is not a valid model", fileName);
UnloadFileData(fileData);
return NULL;
}
if (iqmHeader->version != IQM_VERSION)
{
TRACELOG(LOG_WARNING, "MODEL: [%s] IQM file version not supported (%i)", fileName, iqmHeader->version);
UnloadFileData(fileData);
return NULL;
}

正在加载...
取消
保存