Add av_free() to free s.temp_dwt_buffer and s.temp_idwt_buffer at the end of the function to avoid memory leak.
Unified · Split
| @@ -45,7 +45,8 @@ int main(void){ · 44 unmodified lines | ||
| 45 | 45 | |
| 46 | 46 | if (!s.temp_dwt_buffer || !s.temp_idwt_buffer) { |
| 47 | 47 | fprintf(stderr, "Failed to allocate memory\n"); |
| 48 | − return 1; | |
| 48 | + ret = 1; | |
| 49 | + goto end; | |
| 49 | 50 | } |
| 50 | 51 | |
| 51 | 52 | av_lfg_init(&prng, 1); |
| @@ -145,5 +146,9 @@ int main(void){ · 93 unmodified lines | ||
| 145 | 146 | } |
| 146 | 147 | |
| 147 | 148 | } |
| 149 | + | |
| 150 | +end: | |
| 151 | + av_free(s.temp_dwt_buffer); | |
| 152 | + av_free(s.temp_idwt_buffer); | |
| 148 | 153 | return ret; |
| 149 | 154 | } |