Free metadata if already allocated; fixes a memleak if the header occurs twice
[libav.git] / libavformat / rtsp.c
index 4737814..5100c97 100644 (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;