concatdec: fix metadata memleak on error

Fixes Coverity CID 1323077.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint 2015-10-03 23:48:38 +02:00
parent 854972b53d
commit 80b6cc4214

View File

@ -389,16 +389,16 @@ static int concat_read_header(AVFormatContext *avf)
file->outpoint = dur;
} else if (!strcmp(keyword, "file_packet_metadata")) {
char *metadata;
metadata = av_get_token((const char **)&cursor, SPACE_CHARS);
if (!metadata) {
av_log(avf, AV_LOG_ERROR, "Line %d: packet metadata required\n", line);
FAIL(AVERROR_INVALIDDATA);
}
if (!file) {
av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n",
line, keyword);
FAIL(AVERROR_INVALIDDATA);
}
metadata = av_get_token((const char **)&cursor, SPACE_CHARS);
if (!metadata) {
av_log(avf, AV_LOG_ERROR, "Line %d: packet metadata required\n", line);
FAIL(AVERROR_INVALIDDATA);
}
if ((ret = av_dict_parse_string(&file->metadata, metadata, "=", "", 0)) < 0) {
av_log(avf, AV_LOG_ERROR, "Line %d: failed to parse metadata string\n", line);
av_freep(&metadata);