[asterisk-dev] Is this a bug in frame.c?
Russell Bryant
russell at digium.com
Thu Jun 8 09:56:39 MST 2006
----- Slav Klenov <slav at securax.org> wrote:
> I think theres still a problem when the frame header isn't allocated
> and
> the data allocation fails. Shouldn't we have:
>
> if (!(fr->mallocd & AST_MALLOCD_DATA)) {
> if (!(newdata = ast_malloc(fr->datalen +
> AST_FRIENDLY_OFFSET))) {
> if(out != fr)
> free(out);
> return NULL;
> }
> newdata += AST_FRIENDLY_OFFSET;
> ...
>
> instead?
At this point in the code, the frame header will always be allocatted. However, I think it would still be appropriate to change free(out); to be ast_frfree(out); because the current code is a memory leak. As it stands the frame header gets free'd, but none of its other members do.
--
Russell Bryant
Software Developer
Digium, Inc.
More information about the asterisk-dev
mailing list