[asterisk-commits] file: branch 1.4 r57798 - /branches/1.4/main/slinfactory.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Mar 4 21:19:54 MST 2007


Author: file
Date: Sun Mar  4 22:19:53 2007
New Revision: 57798

URL: http://svn.digium.com/view/asterisk?view=rev&rev=57798
Log:
Don't allow a NULL pointer to reach ast_frdup. (issue #9155 reported by cmaj)

Modified:
    branches/1.4/main/slinfactory.c

Modified: branches/1.4/main/slinfactory.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/slinfactory.c?view=diff&rev=57798&r1=57797&r2=57798
==============================================================================
--- branches/1.4/main/slinfactory.c (original)
+++ branches/1.4/main/slinfactory.c Sun Mar  4 22:19:53 2007
@@ -56,7 +56,7 @@
 
 int ast_slinfactory_feed(struct ast_slinfactory *sf, struct ast_frame *f)
 {
-	struct ast_frame *frame, *frame_ptr;
+	struct ast_frame *begin_frame = f, *duped_frame = NULL, *frame_ptr;
 	unsigned int x;
 
 	if (f->subclass != AST_FORMAT_SLINEAR) {
@@ -74,16 +74,16 @@
 		}
 	}
 
-	if (!(frame = ast_frdup( (sf->trans) ? ast_translate(sf->trans, f, 0) : f )))
+	if ((sf->trans && (!(begin_frame = ast_translate(sf->trans, f, 0)))) || (!(duped_frame = ast_frdup(begin_frame))))
 		return 0;
 
 	x = 0;
 	AST_LIST_TRAVERSE(&sf->queue, frame_ptr, frame_list)
 		x++;
 
-	AST_LIST_INSERT_TAIL(&sf->queue, frame, frame_list);
+	AST_LIST_INSERT_TAIL(&sf->queue, duped_frame, frame_list);
 
-	sf->size += frame->samples;
+	sf->size += duped_frame->samples;
 
 	return x;
 }



More information about the asterisk-commits mailing list