History

avformat/vqf: fix memory leak in add_metadata()

Kacper Michajłow committed 1 year ago

Commit 4ba9ae71 parent ca355091 file · +4 −4Browse files

Unified · Split

libavformat/vqf.c+4−4
@@ -66,10 +66,10 @@ static int add_metadata(AVFormatContext *s, uint32_t tag, · 65 unmodified lines
6666 return AVERROR(ENOMEM);
6767
6868 ret = avio_read(s->pb, buf, len);
69− if (ret < 0)
70− return ret;
71− if (len != ret)
72− return AVERROR_INVALIDDATA;
69+ if (ret < 0 || ret != len) {
70+ av_free(buf);
71+ return ret < 0 ? ret : AVERROR_INVALIDDATA;
72+ }
7373 buf[len] = 0;
7474 AV_WL32(key, tag);
7575 return av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t