if (background != NULL)
SDL_FreeSurface(background);
(Maybe it will work better?)
No, these are exactly the same really. Won’t make any difference.
----- Original Message -----
From: mangoman@kitsuneaye.co.uk (MangoMan)
To:
Sent: Sunday, March 24, 2002 7:27 AM
Subject: Re: [SDL] How do you test if a suface is used
| I do :
|
| if (background != NULL)
| SDL_FreeSurface(background);
|
| (Maybe it will work better?)
That can cause problems…
If you declare background like this:
SDL_Surface *background;
it points at some random memory location. If you then don’t use
’background’ and try to free() it, you may end up free()ing a random
bit of memory. This will quite probably crash your program.On Sun, Mar 24, 2002 at 12:27:11PM +0000, MangoMan wrote:
–
Wedgies are unhealthy for children & other living things
6AD6 865A BF6E 76BB 1FC2 | www.piku.org.uk/public-key.asc
E4C4 DEEA 7D08 D511 E149 | www.piku.org.uk wnzrf at cvxh.bet.hx (rot13’d)