[FFmpeg-devel] [PATCH] concatdec: fix metadata memleak on error

Ronald S. Bultje rsbultje at gmail.com
Sun Oct 4 19:34:03 CEST 2015


Hi,

On Sat, Oct 3, 2015 at 5:59 PM, Marton Balint <cus at passwd.hu> wrote:

> Fixes Coverity CID 1323077.
>
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  libavformat/concatdec.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
> index 88b6dbe..832b7f4 100644
> --- a/libavformat/concatdec.c
> +++ b/libavformat/concatdec.c
> @@ -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);
> --
> 2.1.4


OK.

Ronald


More information about the ffmpeg-devel mailing list