diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-03-12 22:39:27 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-12 22:40:56 +0100 |
commit | 9f8f2bcab6267be2054211dab9d5824af5517201 (patch) | |
tree | a18789bca7ccd31d58d7413ae6aef312880abac7 /libavfilter/formats.c | |
parent | 8b3a681aaa7dc209faa698c189d9b28c102bdc63 (diff) | |
parent | c3bd1d60af97e8d2568dac9fcce7bdabb4ff93c8 (diff) | |
download | ffmpeg-9f8f2bcab6267be2054211dab9d5824af5517201.tar.gz |
Merge commit 'c3bd1d60af97e8d2568dac9fcce7bdabb4ff93c8'
* commit 'c3bd1d60af97e8d2568dac9fcce7bdabb4ff93c8':
formats: Check memory allocations
Conflicts:
libavfilter/formats.c
See: 527ca3985c736ffe077a82fdf3616f0fd571b923
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/formats.c')
-rw-r--r-- | libavfilter/formats.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavfilter/formats.c b/libavfilter/formats.c index eb3b87a56c..f25328ca2d 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -281,12 +281,13 @@ int ff_fmt_is_in(int fmt, const int *fmts) for (count = 0; fmts[count] != -1; count++) \ ; \ formats = av_mallocz(sizeof(*formats)); \ - if (!formats) return NULL; \ + if (!formats) \ + return NULL; \ formats->count_field = count; \ if (count) { \ formats->field = av_malloc_array(count, sizeof(*formats->field)); \ if (!formats->field) { \ - av_free(formats); \ + av_freep(&formats); \ return NULL; \ } \ } @@ -415,6 +416,8 @@ AVFilterChannelLayouts *ff_all_channel_counts(void) do { \ *ref = f; \ f->refs = av_realloc(f->refs, sizeof(*f->refs) * ++f->refcount); \ + if (!f->refs) \ + return; \ f->refs[f->refcount-1] = ref; \ } while (0) |