- [FIX] Small memory leak fixed
This commit is contained in:
3
gif.c
3
gif.c
@@ -434,6 +434,9 @@ static unsigned char* process_gif_stream(unsigned char *buffer, unsigned short*
|
||||
// sizeof( screen_descriptor_t ) = 8!
|
||||
READ(&screen_descriptor, 7);
|
||||
|
||||
if (w) *w = screen_descriptor.width;
|
||||
if (h) *h = screen_descriptor.height;
|
||||
|
||||
color_resolution_bits = ( ( screen_descriptor.fields & 0x70 ) >> 4 ) + 1;
|
||||
|
||||
if ( screen_descriptor.fields & 0x80 )
|
||||
|
||||
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;
|
||||
|
||||
2
jdraw8.h
2
jdraw8.h
@@ -16,7 +16,7 @@ void JD8_Quit();
|
||||
|
||||
void JD8_ClearScreen(Uint8 color);
|
||||
|
||||
JD8_Surface JD8_NewSurface();
|
||||
JD8_Surface JD8_NewSurface(const int w, const int h);
|
||||
|
||||
JD8_Surface JD8_LoadSurface(const char *file);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace module
|
||||
{
|
||||
bool eixir = false;
|
||||
|
||||
fondo_temp = JD8_NewSurface();
|
||||
fondo_temp = JD8_NewSurface(320, 200);
|
||||
JD8_BlitToSurface(0, 0, fondo, 0, 0, 320, 200, fondo_temp);
|
||||
JD8_Blit(fondo_temp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user