History

avfilter/tests/integral: Check malloc fail before using it

Need to check malloc fail before using it, so adjust the location in the code.

Jun Zhao committed 7 years ago

Commit 6382d031 parent 0c3333f1 file · +3 −3Browse files

Unified · Split

libavfilter/tests/integral.c+3−3
@@ -54,6 +54,9 @@ int main(void) · 53 unmodified lines
54 uint32_t *ii = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii));54 uint32_t *ii = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii));
55 uint32_t *ii2 = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii2));55 uint32_t *ii2 = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii2));
56 56
57 if (!ii || !ii2)
58 return -1;
59
57 uint32_t *ii_start = ii + ii_lz_32 + 1; // skip top 0-line and left 0-column60 uint32_t *ii_start = ii + ii_lz_32 + 1; // skip top 0-line and left 0-column
58 uint32_t *ii_start2 = ii2 + ii_lz_32 + 1; // skip top 0-line and left 0-column61 uint32_t *ii_start2 = ii2 + ii_lz_32 + 1; // skip top 0-line and left 0-column
59 62
@@ -61,9 +64,6 @@ int main(void) · 1 unmodified line
61 64
62 ff_nlmeans_init(&dsp);65 ff_nlmeans_init(&dsp);
63 66
64 if (!ii || !ii2)
65 return -1;
66
67 for (yoff = -e; yoff <= e; yoff++) {67 for (yoff = -e; yoff <= e; yoff++) {
68 for (xoff = -e; xoff <= e; xoff++) {68 for (xoff = -e; xoff <= e; xoff++) {
69 printf("xoff=%d yoff=%d\n", xoff, yoff);69 printf("xoff=%d yoff=%d\n", xoff, yoff);

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