X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Frtpdec_qdm2.c;h=1eec2da5b4cc8102f67918c587ad17e3e8d4388a;hb=4e8d22478bc854949a9adbda97348f2997e1dc8d;hp=fa2b1b9302fbdd6e83001ff0ec694bb961de4931;hpb=1811b7d1f5330e04a48b1d6425cf1ef6ed776ed1;p=ffmpeg diff --git a/libavformat/rtpdec_qdm2.c b/libavformat/rtpdec_qdm2.c index fa2b1b9302f..1eec2da5b4c 100644 --- a/libavformat/rtpdec_qdm2.c +++ b/libavformat/rtpdec_qdm2.c @@ -78,6 +78,7 @@ static int qdm2_parse_config(PayloadContext *qdm, AVStream *st, const uint8_t *buf, const uint8_t *end) { const uint8_t *p = buf; + int ret; while (end - p >= 2) { unsigned int item_len = p[0], config_item = p[1]; @@ -104,9 +105,10 @@ static int qdm2_parse_config(PayloadContext *qdm, AVStream *st, case 4: /* stream with extradata */ if (item_len < 30) return AVERROR_INVALIDDATA; - av_freep(&st->codecpar->extradata); - if (ff_alloc_extradata(st->codecpar, 26 + item_len)) { - return AVERROR(ENOMEM); + + ret = ff_alloc_extradata(st->codecpar, 26 + item_len); + if (ret < 0) { + return ret; } AV_WB32(st->codecpar->extradata, 12); memcpy(st->codecpar->extradata + 4, "frma", 4);