diff options
author | Martin Storsjö <martin@martin.st> | 2012-06-17 18:18:16 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-06-17 22:49:25 +0300 |
commit | e9ef88fbd299051df0bb8b344393c50cc1d159d8 (patch) | |
tree | 3c0c8c1c5f2a3e90ba16e60c0d66dcb46ce6fbcb /libavformat/rtpenc.c | |
parent | 5f26d4d44896542e729c7515c784d983e396106a (diff) | |
download | ffmpeg-e9ef88fbd299051df0bb8b344393c50cc1d159d8.tar.gz |
rtpenc: Fix memory leaks in the muxer open function
Also return a proper error code in these cases.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtpenc.c')
-rw-r--r-- | libavformat/rtpenc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 71eeb7e32f..6752fb6f7e 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -198,11 +198,11 @@ static int rtp_write_header(AVFormatContext *s1) /* max_header_toc_size + the largest AMR payload must fit */ if (1 + s->max_frames_per_packet + n > s->max_payload_size) { av_log(s1, AV_LOG_ERROR, "RTP max payload size too small for AMR\n"); - return -1; + goto fail; } if (st->codec->channels != 1) { av_log(s1, AV_LOG_ERROR, "Only mono is supported\n"); - return -1; + goto fail; } case CODEC_ID_AAC: s->num_frames = 0; @@ -216,6 +216,10 @@ defaultcase: } return 0; + +fail: + av_freep(&s->buf); + return AVERROR(EINVAL); } /* send an rtcp sender report packet */ |