Skip to content
Snippets Groups Projects
Commit 4702320f authored by Kevin P. Fleming's avatar Kevin P. Fleming
Browse files

handle out-of-memory conditions in ast_frisolate() properly (reported by Slav...

handle out-of-memory conditions in ast_frisolate() properly (reported by Slav Kenov on asterisk-dev)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@33037 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent a10dff6a
Branches
Tags
No related merge requests found
...@@ -328,14 +328,22 @@ struct ast_frame *ast_frisolate(struct ast_frame *fr) ...@@ -328,14 +328,22 @@ struct ast_frame *ast_frisolate(struct ast_frame *fr)
out = fr; out = fr;
if (!(fr->mallocd & AST_MALLOCD_SRC)) { if (!(fr->mallocd & AST_MALLOCD_SRC)) {
if (fr->src) if (fr->src) {
out->src = strdup(fr->src); if (!(out->src = ast_strdup(fr->src))) {
if (out != fr)
free(out);
return NULL;
}
}
} else } else
out->src = fr->src; out->src = fr->src;
if (!(fr->mallocd & AST_MALLOCD_DATA)) { if (!(fr->mallocd & AST_MALLOCD_DATA)) {
if (!(newdata = ast_malloc(fr->datalen + AST_FRIENDLY_OFFSET))) { if (!(newdata = ast_malloc(fr->datalen + AST_FRIENDLY_OFFSET))) {
free(out); if (out->src != fr->src)
free((void *) out->src);
if (out != fr)
free(out);
return NULL; return NULL;
} }
newdata += AST_FRIENDLY_OFFSET; newdata += AST_FRIENDLY_OFFSET;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment