diff options
author | Jun Zhao <mypopydev@gmail.com> | 2019-02-10 12:57:44 +0800 |
---|---|---|
committer | Jun Zhao <mypopydev@gmail.com> | 2019-02-12 09:08:27 +0800 |
commit | 6382d0334775c0a2d8b945ea5f007e7106431d6d (patch) | |
tree | 55bcc3f899efbbc098c292030b1b335c1b4286e5 /libavfilter/tests | |
parent | 0c3333faf6b7bfd45ce666ae697759d9239ba587 (diff) | |
download | ffmpeg-streaming-6382d0334775c0a2d8b945ea5f007e7106431d6d.zip ffmpeg-streaming-6382d0334775c0a2d8b945ea5f007e7106431d6d.tar.gz |
avfilter/tests/integral: Check malloc fail before using it
Need to check malloc fail before using it, so adjust the location
in the code.
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Diffstat (limited to 'libavfilter/tests')
-rw-r--r-- | libavfilter/tests/integral.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavfilter/tests/integral.c b/libavfilter/tests/integral.c index 2a8e8ff..361bfd5 100644 --- a/libavfilter/tests/integral.c +++ b/libavfilter/tests/integral.c @@ -54,6 +54,9 @@ int main(void) uint32_t *ii = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii)); uint32_t *ii2 = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii2)); + if (!ii || !ii2) + return -1; + uint32_t *ii_start = ii + ii_lz_32 + 1; // skip top 0-line and left 0-column uint32_t *ii_start2 = ii2 + ii_lz_32 + 1; // skip top 0-line and left 0-column @@ -61,9 +64,6 @@ int main(void) ff_nlmeans_init(&dsp); - if (!ii || !ii2) - return -1; - for (yoff = -e; yoff <= e; yoff++) { for (xoff = -e; xoff <= e; xoff++) { printf("xoff=%d yoff=%d\n", xoff, yoff); |