[Asterisk-Dev] strdupa in app_voicemail2.c

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri May 16 09:42:29 MST 2003


On Friday 16 May 2003 10:25 am, Thorsten Lockert wrote:
> Some plain strdupa's snuck into the new voicemail system -- the
> attached diff changes these to use ast_strdupa like all other
> instances.

I'm curious to know how this can be done.  Given that strdupa relies
upon alloca, which is not a library function, but instead is a
compiler directive, how can it allocate space in a function, but
return that same space to a higher function without freeing it (as the
allocation was on the same stack which was just freed)?  What am I
missing here?

-Tilghman




More information about the asterisk-dev mailing list