mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-26 23:29:53 +00:00
fix: avoid undefined behavior on image mask allocation failure (#1198)
This commit is contained in:
parent
7010bb4dff
commit
fbce16e02d
1 changed files with 1 additions and 1 deletions
|
|
@ -594,12 +594,12 @@ int main(int argc, const char* argv[]) {
|
|||
}
|
||||
} else {
|
||||
mask_image.data = (uint8_t*)malloc(gen_params.width * gen_params.height);
|
||||
memset(mask_image.data, 255, gen_params.width * gen_params.height);
|
||||
if (mask_image.data == nullptr) {
|
||||
LOG_ERROR("malloc mask image failed");
|
||||
release_all_resources();
|
||||
return 1;
|
||||
}
|
||||
memset(mask_image.data, 255, gen_params.width * gen_params.height);
|
||||
}
|
||||
|
||||
if (gen_params.control_image_path.size() > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue