[asterisk-dev] Problems with ast_realloc Version 1.4.5

Sergey Okhapkin sos at sokhapkin.dyndns.org
Sun Jun 24 12:08:09 CDT 2007


ast_realloc is a wrapper for malloc() and friends. alloca() is a completely 
different thing, you can't mix them.

On Sunday 24 June 2007 12:44, Alvaro Parres wrote:
> Hi list i'm having some problems with the ast_realloac function
>
>
> I have this code:
>
>                    char *temporal;
>                    temporal = alloca(20);
>                    memset(temporal,0,20);
>                    strcpy(temporal,"Hola");
>                    ast_verbose(VERBOSE_PREFIX_4 "Temporal: %s",temporal);
>                    temporal = (char *) ast_realloc(temporal,21);
>                    ast_verbose(VERBOSE_PREFIX_4 "Temporal: %s",temporal);
>
> And the output at the asterisk is
>
>      > Temporal: Hola
>
>      WARNING: Realloc of unalloced memory at 0xb65c4960, in ldapget_exec of
> app_ldap.c, line 194
>
>      > Temporal: (null)
>
> I don't know if any one of you can help me with this.
>
> Thanks.



More information about the asterisk-dev mailing list