diff options
| author | Dusan Durech <dusan.d@centrum.sk> | 2008-11-09 16:26:16 +0100 |
|---|---|---|
| committer | Dusan Durech <dusan.d@centrum.sk> | 2008-11-09 16:26:16 +0100 |
| commit | 4bd8ea7c07e2f3a8c595aed5d166bb823720c2b8 (patch) | |
| tree | e053a2a9f4f3082e5d5191e312d2df4bae92621f /src | |
| parent | 77459ad09cbcc1004801f527ce82caa2cbdf6451 (diff) | |
fix memory leak with image in openGL code
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/font.c | 8 | ||||
| -rw-r--r-- | src/client/image.c | 2 |
2 files changed, 2 insertions, 8 deletions
diff --git a/src/client/font.c b/src/client/font.c index 45ef5e4..8d522b2 100644 --- a/src/client/font.c +++ b/src/client/font.c @@ -61,10 +61,6 @@ void drawFont(char *string, int x, int y, int r, int g, int b) image = newImage(text); drawImage(image, x, y, 0, 0, image->w, image->h); destroyImage(image); - -#ifdef SUPPORT_OPENGL - SDL_FreeSurface(text); // we don't need text anymore -#endif }; } @@ -107,10 +103,6 @@ void drawFontMaxSize(char *s, int x, int y, int w, int h, int r, int g, int b) //posibly broken drawImage(i, x, y, 0, 0, my_w, my_h); destroyImage(i); - -#ifdef SUPPORT_OPENGL - SDL_FreeSurface(text); // we don't need text anymore -#endif } /* diff --git a/src/client/image.c b/src/client/image.c index c863849..38296e7 100644 --- a/src/client/image.c +++ b/src/client/image.c @@ -147,6 +147,8 @@ image_t* newImage(SDL_Surface *surface) new->tex_id = tid; + SDL_FreeSurface(surface); + return new; } #endif |