av_image_fill_plane_sizes() already sets sizes[1] to AVPALETTE_SIZE. Should fix memory leaks.
Unified · Split
| @@ -56,13 +56,9 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size), · 55 unmodified lines | |||
| 56 | { | 56 | { |
| 57 | int i, ret; | 57 | int i, ret; |
| 58 | FFFramePool *pool; | 58 | FFFramePool *pool; |
| 59 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format); | ||
| 60 | ptrdiff_t linesizes[4]; | 59 | ptrdiff_t linesizes[4]; |
| 61 | size_t sizes[4]; | 60 | size_t sizes[4]; |
| 62 | 61 | ||
| 63 | if (!desc) | ||
| 64 | return NULL; | ||
| 65 | |||
| 66 | pool = av_mallocz(sizeof(FFFramePool)); | 62 | pool = av_mallocz(sizeof(FFFramePool)); |
| 67 | if (!pool) | 63 | if (!pool) |
| 68 | return NULL; | 64 | return NULL; |
| @@ -108,12 +104,6 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size), · 39 unmodified lines | |||
| 108 | goto fail; | 104 | goto fail; |
| 109 | } | 105 | } |
| 110 | 106 | ||
| 111 | if (desc->flags & AV_PIX_FMT_FLAG_PAL) { | ||
| 112 | pool->pools[1] = av_buffer_pool_init(AVPALETTE_SIZE, alloc); | ||
| 113 | if (!pool->pools[1]) | ||
| 114 | goto fail; | ||
| 115 | } | ||
| 116 | |||
| 117 | return pool; | 107 | return pool; |
| 118 | 108 | ||
| 119 | fail: | 109 | fail: |