diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-04-01 18:11:48 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-04-01 18:11:48 +0200 |
commit | 5b911f1d5be45dd125ea48f0e9ff0cdeacba4dac (patch) | |
tree | 3f6468616d2f62521ffb9fc9b8148f216013e6f5 /libavformat/webmdashenc.c | |
parent | 5b32558fd805c48035d6e0c23b4807c81286ee34 (diff) | |
download | ffmpeg-5b911f1d5be45dd125ea48f0e9ff0cdeacba4dac.tar.gz |
avformat/webmdashenc: use AVERROR(ENOMEM) for memory allocation failures
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/webmdashenc.c')
-rw-r--r-- | libavformat/webmdashenc.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c index 4536b7d5a8..b54a1d2ec4 100644 --- a/libavformat/webmdashenc.c +++ b/libavformat/webmdashenc.c @@ -271,7 +271,8 @@ static int to_integer(char *p, int len) { int ret; char *q = av_malloc(sizeof(char) * len); - if (!q) return -1; + if (!q) + return AVERROR(ENOMEM); av_strlcpy(q, p, len); ret = atoi(q); av_free(q); @@ -291,7 +292,8 @@ static int parse_adaptation_sets(AVFormatContext *s) continue; else if (state == new_set && !strncmp(p, "id=", 3)) { w->as = av_realloc(w->as, sizeof(*w->as) * ++w->nb_as); - if (w->as == NULL) return -1; + if (w->as == NULL) + return AVERROR(ENOMEM); w->as[w->nb_as - 1].nb_streams = 0; w->as[w->nb_as - 1].streams = NULL; p += 3; // consume "id=" @@ -308,7 +310,8 @@ static int parse_adaptation_sets(AVFormatContext *s) q = p; while (*q != '\0' && *q != ',' && *q != ' ') q++; as->streams = av_realloc(as->streams, sizeof(*as->streams) * ++as->nb_streams); - if (as->streams == NULL) return -1; + if (as->streams == NULL) + return AVERROR(ENOMEM); as->streams[as->nb_streams - 1] = to_integer(p, q - p + 1); if (as->streams[as->nb_streams - 1] < 0) return -1; if (*q == '\0') break; |