changeset 4777:31678a2764ee libavformat

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.
author rbultje
date Sat, 21 Mar 2009 20:59:59 +0000
parents 894e353aaeca
children dd4e4ba1535f
files rtsp.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rtsp.c	Sat Mar 21 20:58:41 2009 +0000
+++ b/rtsp.c	Sat Mar 21 20:59:59 2009 +0000
@@ -202,6 +202,8 @@
             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;