Dear all,
The API function “SDL_iconv_string” use a malloc as this:
string = SDL_malloc(stringsize);
This function is without a memory free operation and obviously cant do this because it returns the pointer malloced.
So I think this maybe a small bug. Isnt it?
Thanks…
-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL_iconv.c
Type: text/x-csrc
Size: 19716 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080430/065ff7f4/attachment.c
Hello !
The API function "SDL_iconv_string" use a malloc as this: string = SDL_malloc(stringsize); This function is without a memory free operation and obviously cant do this because it returns the pointer malloced. So I think this maybe a small bug. Isnt it?
No, why ? This is a design question. It would be possible to
either return a new malloced string or to copy the new string into
an existing one. SDL chooeses most of the time the first variant,
also for SDL_Surfaces for example.
CU
So I think this maybe a small bug. Isnt it?
No. The API documentation says the caller is required to call SDL_free()
on the returned value.
If you don’t want it to allocate memory, use SDL_iconv() instead of
SDL_iconv_string().
–ryan.