History

avformat/webmdashenc: Fix memleak upon realloc failure

The classical ptr = av_realloc(ptr, size).

Andreas Rheinhardt committed 6 years ago

Commit 418e4681 parent 3875af81 file · +4 −3Browse files

Unified · Split

libavformat/webmdashenc.c+4−3
@@ -488,11 +488,12 @@ static int parse_adaptation_sets(AVFormatContext *s) · 487 unmodified lines
488488 state = parsing_streams;
489489 } else if (state == parsing_streams) {
490490 struct AdaptationSet *as = &w->as[w->nb_as - 1];
491+ int ret = av_reallocp_array(&as->streams, ++as->nb_streams,
492+ sizeof(*as->streams));
493+ if (ret < 0)
494+ return ret;
491495 q = p;
492496 while (*q != '\0' && *q != ',' && *q != ' ') q++;
493− as->streams = av_realloc(as->streams, sizeof(*as->streams) * ++as->nb_streams);
494− if (as->streams == NULL)
495− return AVERROR(ENOMEM);
496497 as->streams[as->nb_streams - 1] = to_integer(p, q - p + 1);
497498 if (as->streams[as->nb_streams - 1] < 0 ||
498499 as->streams[as->nb_streams - 1] >= s->nb_streams) {

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