Index: frame.c =================================================================== --- frame.c (revision 13064) +++ frame.c (working copy) @@ -304,6 +304,7 @@ struct ast_frame *ast_frisolate(struct ast_frame *fr) { struct ast_frame *out; + void *newdata; if (!(fr->mallocd & AST_MALLOCD_HDR)) { /* Allocate a new header if needed */ if (!(out = ast_frame_header_new())) { @@ -325,14 +326,15 @@ } else out->src = fr->src; if (!(fr->mallocd & AST_MALLOCD_DATA)) { - if (!(out->data = ast_malloc(fr->datalen + AST_FRIENDLY_OFFSET))) { + if (!(newdata = ast_malloc(fr->datalen + AST_FRIENDLY_OFFSET))) { free(out); return NULL; } - out->data += AST_FRIENDLY_OFFSET; + newdata += AST_FRIENDLY_OFFSET; out->offset = AST_FRIENDLY_OFFSET; out->datalen = fr->datalen; - memcpy(out->data, fr->data, fr->datalen); + memcpy(newdata, fr->data, fr->datalen); + out->data = newdata; } out->mallocd = AST_MALLOCD_HDR | AST_MALLOCD_SRC | AST_MALLOCD_DATA; return out;