aboutsummaryrefslogtreecommitdiffstats
path: root/main/slinfactory.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-05 04:19:53 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-05 04:19:53 +0000
commit8a921603bf83c5ce9ae3ac248faf4657425f23a8 (patch)
treeda60cf8441314c8558f518696961d584eff56a5f /main/slinfactory.c
parentea706af7773894b888b67504cef3685fd4935846 (diff)
Don't allow a NULL pointer to reach ast_frdup. (issue #9155 reported by cmaj)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@57798 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/slinfactory.c')
-rw-r--r--main/slinfactory.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/main/slinfactory.c b/main/slinfactory.c
index a07798b7c..6171eb2e2 100644
--- a/main/slinfactory.c
+++ b/main/slinfactory.c
@@ -56,7 +56,7 @@ void ast_slinfactory_destroy(struct ast_slinfactory *sf)
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 @@ int ast_slinfactory_feed(struct ast_slinfactory *sf, struct ast_frame *f)
}
}
- 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;
}