Freeing surfaces and overlays, problems


I’m new to sdl and it seems to be really good. I have some problems in freeing
surfaces and/or overlays. I’m working under linux (see Hardware/Software
description at the end of this mail).

My problem only happens at the end of my program: I try to free an overlay and
then my program segfaults (in the __morecore libc function called by
SDL_FreeYUVOverlay() ) whereas this overlay is freed and recreated during
the execution with no critical problems.

When I comment all the code that frees the surfaces and the overlays (yes it’s
bad but it’s a good test :p) the program segfaults in SDL_Quit().

I saw that this problem has already been discussed last year in the thread:

"[SDL] Re: error freeing surface?"

but I didn’t see the answer I was waiting for, just somme stuff about C++
delete behaviour. And no I don’t free twice my data. So I wonder if it is a
known SDL bug. Could it be my X driver ?

Moreover In the piece of code that frees my overlay without crashing, the
video memory seems not to be freed. The memory is only freed when the program
ends so I have a huge video memory leak when I recreate my overlay more
than once. I wonder if it’s a bug of my NVidia driver (seems they have/had?
huge memory leaks in their known bugs list) or a SDL one.

Has anybody seen such a behaviour ?

Hardware: Celeron 450
ASUS TNT Video adpater AGP, 16MB video RAM

Software: Debian GNU/Linux woody
XFree86 v4
NVidia X drivers correctly installed
SDL 1.1.6 (handly compiled or woody version: no differences)
I haven’t tested cvs version but a friend said me that the bug
was still here.