History

tests/checkasm/sw_rgb: Fix leaks

Also use loop-scope for variables where appropriate.

Andreas Rheinhardt committed 1 year ago

Commit 5a722661 parent e5403811 file · +15 −8Browse files

Unified · Split

tests/checkasm/sw_rgb.c+15−8
@@ -536,9 +536,6 @@ static const int packed_rgb_fmts[] = { · 535 unmodified lines
536536
537537 static void check_yuv2packed1(void)
538538 {
539− SwsContext *sws;
540− SwsInternal *c;
541−
542539 static const int alpha_values[] = {0, 2048, 4096};
543540
544541 declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
@@ -583,6 +580,9 @@ static void check_yuv2packed1(void) · 38 unmodified lines
583580 for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
584581 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
585582 int line_size = INPUT_SIZE * desc->comp[0].step;
583+ SwsContext *sws;
584+ SwsInternal *c;
585+
586586 if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
587587 line_size = AV_CEIL_RSHIFT(line_size, 3);
588588
@@ -609,13 +609,13 @@ static void check_yuv2packed1(void) · 20 unmodified lines
609609 bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, chr_alpha, 0);
610610 }
611611 }
612+
613+ sws_freeContext(sws);
612614 }
613615 }
614616
615617 static void check_yuv2packed2(void)
616618 {
617− SwsContext *sws;
618− SwsInternal *c;
619619 static const int alpha_values[] = {0, 2048, 4096};
620620
621621 declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
@@ -660,6 +660,9 @@ static void check_yuv2packed2(void) · 38 unmodified lines
660660 for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
661661 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
662662 int line_size = INPUT_SIZE * desc->comp[0].step;
663+ SwsContext *sws;
664+ SwsInternal *c;
665+
663666 if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
664667 line_size = AV_CEIL_RSHIFT(line_size, 3);
665668
@@ -687,14 +690,13 @@ static void check_yuv2packed2(void) · 21 unmodified lines
687690 bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, lum_alpha, chr_alpha, 0);
688691 }
689692 }
693+
694+ sws_freeContext(sws);
690695 }
691696 }
692697
693698 static void check_yuv2packedX(void)
694699 {
695− SwsContext *sws;
696− SwsInternal *c;
697−
698700 #define LARGEST_FILTER 16
699701 static const int filter_sizes[] = {2, 16};
700702
@@ -745,6 +747,9 @@ static void check_yuv2packedX(void) · 44 unmodified lines
745747 for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
746748 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
747749 int line_size = INPUT_SIZE * desc->comp[0].step;
750+ SwsContext *sws;
751+ SwsInternal *c;
752+
748753 if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
749754 line_size = AV_CEIL_RSHIFT(line_size, 3);
750755
@@ -788,6 +793,8 @@ static void check_yuv2packedX(void) · 37 unmodified lines
788793 alpha, dst1, INPUT_SIZE, 0);
789794 }
790795 }
796+
797+ sws_freeContext(sws);
791798 }
792799 }
793800

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