mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avfilter/vf_removelogo: fix memleak on failure
Fixes CID751770 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
8e07800001
commit
6b9e0bf42f
@ -318,12 +318,16 @@ static av_cold int init(AVFilterContext *ctx)
|
|||||||
|
|
||||||
for (a = 0; a <= s->max_mask_size; a++) {
|
for (a = 0; a <= s->max_mask_size; a++) {
|
||||||
mask[a] = (int **)av_malloc(sizeof(int *) * ((a * 2) + 1));
|
mask[a] = (int **)av_malloc(sizeof(int *) * ((a * 2) + 1));
|
||||||
if (!mask[a])
|
if (!mask[a]) {
|
||||||
|
av_free(mask);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
for (b = -a; b <= a; b++) {
|
for (b = -a; b <= a; b++) {
|
||||||
mask[a][b + a] = (int *)av_malloc(sizeof(int) * ((a * 2) + 1));
|
mask[a][b + a] = (int *)av_malloc(sizeof(int) * ((a * 2) + 1));
|
||||||
if (!mask[a][b + a])
|
if (!mask[a][b + a]) {
|
||||||
|
av_free(mask);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
for (c = -a; c <= a; c++) {
|
for (c = -a; c <= a; c++) {
|
||||||
if ((b * b) + (c * c) <= (a * a)) /* Circular 0/1 mask. */
|
if ((b * b) + (c * c) <= (a * a)) /* Circular 0/1 mask. */
|
||||||
mask[a][b + a][c + a] = 1;
|
mask[a][b + a][c + a] = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user