asprintf
Over a year ago, I created a new function called sprintfAlloc that was like sprintf, except it printed into and returned a newly-allocated chunk of memory. For more details, check out the original post.
In my travels since then, I’ve run across another function, in the GNU C library, that does the same thing. This function is called asprintf, and has this signature:
int asprintf(char** ret, const char* format, ...);
For more information, check out the manual page.