[asterisk-commits] trunk r33037 - in /trunk: ./ frame.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Jun 8 09:59:44 MST 2006
Author: kpfleming
Date: Thu Jun 8 11:59:44 2006
New Revision: 33037
URL: http://svn.digium.com/view/asterisk?rev=33037&view=rev
Log:
handle out-of-memory conditions in ast_frisolate() properly (reported by Slav Kenov on asterisk-dev)
Modified:
trunk/ (props changed)
trunk/frame.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Modified: trunk/frame.c
URL: http://svn.digium.com/view/asterisk/trunk/frame.c?rev=33037&r1=33036&r2=33037&view=diff
==============================================================================
--- trunk/frame.c (original)
+++ trunk/frame.c Thu Jun 8 11:59:44 2006
@@ -328,14 +328,22 @@
out = fr;
if (!(fr->mallocd & AST_MALLOCD_SRC)) {
- if (fr->src)
- out->src = strdup(fr->src);
+ if (fr->src) {
+ if (!(out->src = ast_strdup(fr->src))) {
+ if (out != fr)
+ free(out);
+ return NULL;
+ }
+ }
} else
out->src = fr->src;
if (!(fr->mallocd & AST_MALLOCD_DATA)) {
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;
}
newdata += AST_FRIENDLY_OFFSET;
More information about the asterisk-commits
mailing list