fix: avoid potential dangling pointer problem
This commit is contained in:
parent
195d170136
commit
30b3ac8e62
@ -931,12 +931,12 @@ int main(int argc, const char* argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<uint8_t> default_mask_image_vec(params.width * params.height, 255);
|
||||||
if (params.mask_path != "") {
|
if (params.mask_path != "") {
|
||||||
int c = 0;
|
int c = 0;
|
||||||
mask_image_buffer = stbi_load(params.mask_path.c_str(), ¶ms.width, ¶ms.height, &c, 1);
|
mask_image_buffer = stbi_load(params.mask_path.c_str(), ¶ms.width, ¶ms.height, &c, 1);
|
||||||
} else {
|
} else {
|
||||||
std::vector<uint8_t> arr(params.width * params.height, 255);
|
mask_image_buffer = default_mask_image_vec.data();
|
||||||
mask_image_buffer = arr.data();
|
|
||||||
}
|
}
|
||||||
sd_image_t mask_image = {(uint32_t)params.width,
|
sd_image_t mask_image = {(uint32_t)params.width,
|
||||||
(uint32_t)params.height,
|
(uint32_t)params.height,
|
||||||
|
Loading…
Reference in New Issue
Block a user