mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Fixed a memory leak in Canvas:getImageData() (issue #590)
This commit is contained in:
@@ -615,13 +615,12 @@ love::image::ImageData *Canvas::getImageData(love::image::Image *image)
|
||||
|
||||
GLubyte *src = pixels, *dst = flipped + size - row;
|
||||
for (int i = 0; i < height; ++i, dst -= row, src += row)
|
||||
{
|
||||
memcpy(dst, src, row);
|
||||
}
|
||||
|
||||
love::image::ImageData *img = image->newImageData(width, height, (void *)flipped);
|
||||
|
||||
delete[] pixels;
|
||||
delete[] flipped;
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user