aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2009-03-21 20:59:59 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2009-03-21 20:59:59 +0000
commit7d09a993d14c420ce53070312e77a224dbb4bc99 (patch)
treed52774680486740df2abb18d414ce7375122af6f
parent6a8c8b36b9f9a87daa02140c006f55f1a795294e (diff)
downloadffmpeg-7d09a993d14c420ce53070312e77a224dbb4bc99.tar.gz
Free metadata if already allocated; fixes a memleak if the header occurs twice
in a stream (e.g. malicious input, broken file, etc.). See summary in "[PATCH] rtsp.c small cleanups" thread on mailinglist. Originally committed as revision 18126 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/rtsp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 47378146fe..5100c978e6 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -202,6 +202,8 @@ static void sdp_parse_fmtp_config(AVCodecContext *codec, char *attr, char *value
if (!strcmp(attr, "config")) {
/* decode the hexa encoded parameter */
int len = hex_to_data(NULL, value);
+ if (codec->extradata)
+ av_free(codec->extradata);
codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
if (!codec->extradata)
return;