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

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
This commit is contained in:
Ronald S. Bultje 2009-03-21 20:59:59 +00:00
parent 6a8c8b36b9
commit 7d09a993d1

View File

@ -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;