mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-02-04 02:43:36 +00:00
fix: avoid undefined behavior on image mask allocation failure (#1198)
This commit is contained in:
parent
7010bb4dff
commit
fbce16e02d
@ -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…
x
Reference in New Issue
Block a user