Correct bug in which Backend_LockSurface would not initialize surface->pixels, leaving a bug in which Backend_UnlockSurface used uninitialized values in certain scenarios (such as in ScaleAndUploadSurface)

Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
Gabriel Ravier 2020-01-06 10:53:43 +01:00
parent befb5f7fb5
commit 752b4cee3f

View file

@ -154,7 +154,7 @@ unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch
*pitch = surface->width * 3;
surface->pixels = (unsigned char*)malloc(surface->width * surface->height * 3);
surface->pixels = (unsigned char*)calloc(surface->width * surface->height * 3, 1); // Make sure these are initialized
return surface->pixels;
}