[asterisk-commits] branch oej/test-this-branch r13355 -
/team/oej/test-this-branch/frame.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Mar 17 03:24:14 MST 2006
Author: oej
Date: Fri Mar 17 04:24:12 2006
New Revision: 13355
URL: http://svn.digium.com/view/asterisk?rev=13355&view=rev
Log:
Possible memory leak
Modified:
team/oej/test-this-branch/frame.c
Modified: team/oej/test-this-branch/frame.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/frame.c?rev=13355&r1=13354&r2=13355&view=diff
==============================================================================
--- team/oej/test-this-branch/frame.c (original)
+++ team/oej/test-this-branch/frame.c Fri Mar 17 04:24:12 2006
@@ -299,7 +299,7 @@
/*!
* \brief 'isolates' a frame by duplicating non-malloc'ed components
* (header, src, data).
- * On return all components are malloc'ed
+ * \return On return all components are malloc'ed
*/
struct ast_frame *ast_frisolate(struct ast_frame *fr)
{
@@ -335,14 +335,16 @@
} else
out->src = fr->src;
if (!(fr->mallocd & AST_MALLOCD_DATA)) {
- if (!(out->data = ast_malloc(fr->datalen + AST_FRIENDLY_OFFSET))) {
+ void *payload;
+ if (!(payload = ast_malloc(fr->datalen + AST_FRIENDLY_OFFSET))) {
free(out);
return NULL;
}
- out->data += AST_FRIENDLY_OFFSET;
+ payload += AST_FRIENDLY_OFFSET;
out->offset = AST_FRIENDLY_OFFSET;
out->datalen = fr->datalen;
- memcpy(out->data, fr->data, fr->datalen);
+ memcpy(payload, fr->data, fr->datalen);
+ out->data = payload;
}
out->mallocd = AST_MALLOCD_HDR | AST_MALLOCD_SRC | AST_MALLOCD_DATA;
return out;
More information about the asterisk-commits
mailing list