X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fapetag.c;h=454c6c688bd2b0c7fde6eead30cd7799d1705a0c;hb=9086af2a0a590c7f576b72379d1708392cd96d5c;hp=8cb3f4a23af41db978b402560592f61e65b67b9a;hpb=0084eed5bffebd7f3915bc0f9eba7350e8bc0ef7;p=ffmpeg diff --git a/libavformat/apetag.c b/libavformat/apetag.c index 8cb3f4a23af..454c6c688bd 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -96,8 +96,8 @@ static int ape_tag_read_field(AVFormatContext *s) st->attached_pic.stream_index = st->index; st->attached_pic.flags |= AV_PKT_FLAG_KEY; } else { - if (ff_get_extradata(s, st->codecpar, s->pb, size) < 0) - return AVERROR(ENOMEM); + if ((ret = ff_get_extradata(s, st->codecpar, s->pb, size)) < 0) + return ret; st->codecpar->codec_type = AVMEDIA_TYPE_ATTACHMENT; } } else { @@ -186,11 +186,11 @@ int ff_ape_write_tag(AVFormatContext *s) { AVDictionaryEntry *e = NULL; int size, ret, count = 0; - AVIOContext *dyn_bc = NULL; - uint8_t *dyn_buf = NULL; + AVIOContext *dyn_bc; + uint8_t *dyn_buf; if ((ret = avio_open_dyn_buf(&dyn_bc)) < 0) - goto end; + return ret; ff_standardize_creation_time(s); while ((e = av_dict_get(s->metadata, "", e, AV_DICT_IGNORE_SUFFIX))) { @@ -211,7 +211,7 @@ int ff_ape_write_tag(AVFormatContext *s) if (!count) goto end; - size = avio_close_dyn_buf(dyn_bc, &dyn_buf); + size = avio_get_dyn_buf(dyn_bc, &dyn_buf); if (size <= 0) goto end; size += APE_TAG_FOOTER_BYTES; @@ -239,9 +239,7 @@ int ff_ape_write_tag(AVFormatContext *s) ffio_fill(s->pb, 0, 8); // reserved end: - if (dyn_bc && !dyn_buf) - avio_close_dyn_buf(dyn_bc, &dyn_buf); - av_freep(&dyn_buf); + ffio_free_dyn_buf(&dyn_bc); return ret; }