提交 00408675 编写于 作者: O openharmony_ci 提交者: Gitee

!486 图片数据释放后把data置为nullptr

Merge pull request !486 from wangtiantian/bug_image_m
......@@ -114,6 +114,7 @@ RetCode FileImgDecoder::ReadToCache(ImgResDsc& dsc)
uint32_t pxCount = info.st_size - readCount;
if (dsc.imgInfo.data != nullptr) {
ImageCacheFree(dsc.imgInfo);
dsc.imgInfo.data = nullptr;
}
bool readSuccess = false;
......@@ -130,6 +131,7 @@ RetCode FileImgDecoder::ReadToCache(ImgResDsc& dsc)
}
if (!readSuccess) {
ImageCacheFree(dsc.imgInfo);
dsc.imgInfo.data = nullptr;
dsc.imgInfo.dataSize = 0;
close(dsc.fd);
dsc.fd = -1;
......
......@@ -114,6 +114,7 @@ bool ImageLoad::UnzipImage(uint8_t* imageBuffer, uint32_t size, ImageInfo& image
return true;
}
ImageCacheFree(imageInfo);
imageInfo.data = nullptr;
return false;
}
......@@ -170,6 +171,7 @@ bool ImageLoad::Unzip24Image(uint8_t* imageBuffer, uint32_t size, ImageInfo& ima
return true;
}
ImageCacheFree(imageInfo);
imageInfo.data = nullptr;
return false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册