Damien Carbery wrote: > In totem 2.21.0 there are two references to asprintf(). > This function does not appear to be in Solaris. > > The attached patch does a malloc/sprintf as a replacement (seen in > patches/liboil-01-fixcompile.diff). > > Is this the correct way to do this? The liboil patch doesn't mention any > free(). Should this patch? > > Damien >
Allocating 2k buffers for every sub-node is going to chew up more memory than required. Since asprintf allocates the output buffer like a malloc+sprintf combination, I imagine there's a free done somewhere already. I'd normally use g_strdup_printf for this purpose, but it looks like Bastian is avoiding pulling glib.h into this file for some reason (probably because he's using the same file in Xine). Changing it to use g_strdup_printf would also mean finding where the free() is done and using g_free instead. I would probably opt for implementing a local asprintf that maintains a local static buffer, snprintf's into that and then strcpy's to a fresh output buffer. J.
