1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Remove use of MAX_STREAMS in MMSContext->streams[] array. Instead, dynamically

allocate the array.

Originally committed as revision 24794 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Ronald S. Bultje 2010-08-13 17:30:01 +00:00
parent c46000c1ff
commit 67197656d1
3 changed files with 6 additions and 1 deletions

View File

@ -99,6 +99,9 @@ int ff_mms_asf_header_parser(MMSContext *mms)
//Please see function send_stream_selection_request(). //Please see function send_stream_selection_request().
if (mms->stream_num < MAX_STREAMS && if (mms->stream_num < MAX_STREAMS &&
46 + mms->stream_num * 6 < sizeof(mms->out_buffer)) { 46 + mms->stream_num * 6 < sizeof(mms->out_buffer)) {
mms->streams = av_fast_realloc(mms->streams,
&mms->nb_streams_allocated,
(mms->stream_num + 1) * sizeof(MMSStream));
mms->streams[mms->stream_num].id = stream_id; mms->streams[mms->stream_num].id = stream_id;
mms->stream_num++; mms->stream_num++;
} else { } else {

View File

@ -29,7 +29,7 @@ typedef struct {
typedef struct { typedef struct {
URLContext *mms_hd; ///< TCP connection handle URLContext *mms_hd; ///< TCP connection handle
MMSStream streams[MAX_STREAMS]; MMSStream *streams;
/** Buffer for outgoing packets. */ /** Buffer for outgoing packets. */
/*@{*/ /*@{*/
@ -54,6 +54,7 @@ typedef struct {
/*@}*/ /*@}*/
int stream_num; ///< stream numbers. int stream_num; ///< stream numbers.
unsigned int nb_streams_allocated; ///< allocated size of streams
} MMSContext; } MMSContext;
int ff_mms_asf_header_parser(MMSContext * mms); int ff_mms_asf_header_parser(MMSContext * mms);

View File

@ -468,6 +468,7 @@ static int mms_close(URLContext *h)
} }
/* free all separately allocated pointers in mms */ /* free all separately allocated pointers in mms */
av_free(mms->streams);
av_free(mms->asf_header); av_free(mms->asf_header);
av_freep(&h->priv_data); av_freep(&h->priv_data);