Fix: Mantaflow: move allocation after early return #121104

Merged
YimingWu merged 1 commits from ChengduLittleA/blender:fixmem4 into main 2024-04-26 06:31:36 +02:00
1 changed files with 2 additions and 2 deletions

View File

@ -152,8 +152,6 @@ bool SimpleImage::initFromPpm(std::string filename)
rowsize = windW * 3;
}
unsigned char *pic = new unsigned char[size]; // (GLubyte *)malloc (size);
// Read in maximum value (ignore) , could be scanned with sscanf as well, but this should be
// 255... 3rd line
if (fgets(line, MAXLINE, fp) == nullptr) {
@ -162,6 +160,8 @@ bool SimpleImage::initFromPpm(std::string filename)
return 0;
}
unsigned char *pic = new unsigned char[size]; // (GLubyte *)malloc (size);
// Read in the pixel array row-by-row: 1st row = top scanline */
unsigned char *ptr = nullptr;
ptr = &pic[(windH - 1) * rowsize];