- [FIX] Small memory leak fixed
This commit is contained in:
10
jdraw8.cpp
10
jdraw8.cpp
@@ -50,9 +50,9 @@ void JD8_ClearScreen(Uint8 color) {
|
||||
memset( screen, color, 64000 );
|
||||
}
|
||||
|
||||
JD8_Surface JD8_NewSurface() {
|
||||
JD8_Surface surface = (JD8_Surface)malloc( 64000 );
|
||||
memset( surface, 0, 64000 );
|
||||
JD8_Surface JD8_NewSurface(const int w, const int h) {
|
||||
JD8_Surface surface = (JD8_Surface)malloc( w * h );
|
||||
memset( surface, 0, w*h );
|
||||
return surface;
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ JD8_Surface JD8_LoadSurface(const char *file) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
JD8_Surface image = JD8_NewSurface();
|
||||
memcpy(image, pixels, 64000);
|
||||
JD8_Surface image = JD8_NewSurface(w, h);
|
||||
memcpy(image, pixels, w * h);
|
||||
|
||||
free(pixels);
|
||||
return image;
|
||||
|
||||
Reference in New Issue
Block a user