Commit 739132b015 for ffmpeg

commit 739132b015dc59a350eb0a56cef4c025d8f8e210
Author: Kacper Michajłow <kasper93@gmail.com>
Date:   Wed Sep 23 17:21:29 2026 +0200

    swresample/tests/swresample: fail when a context cannot be initialized

    swr_init() failures were only printed and the test still exited with 0.
    Return failure through the cleanup instead, also for the allocation
    failures that returned without it.

    Signed-off-by: Kacper Michajłow <kasper93@gmail.com>

diff --git a/libswresample/tests/swresample.c b/libswresample/tests/swresample.c
index 227203a4d6..965b2d3002 100644
--- a/libswresample/tests/swresample.c
+++ b/libswresample/tests/swresample.c
@@ -237,6 +237,7 @@ int main(int argc, char **argv){
     int max_tests = FF_ARRAY_ELEMS(remaining_tests);
     int test;
     int specific_test= -1;
+    int ret = 0;

     struct SwrContext * forw_ctx= NULL;
     struct SwrContext *backw_ctx= NULL;
@@ -301,19 +302,27 @@ int main(int argc, char **argv){
                                            &in_ch_layout,   in_sample_fmt,  in_sample_rate,
                                            0, 0) < 0) {
             fprintf(stderr, "Failed to init forw_cts\n");
-            return 1;
+            ret = 1;
+            goto end;
         }
         if (swr_alloc_set_opts2(&backw_ctx, &in_ch_layout,   in_sample_fmt,  in_sample_rate,
                                             &out_ch_layout, out_sample_fmt, out_sample_rate,
                                             0, 0) < 0) {
             fprintf(stderr, "Failed to init backw_ctx\n");
-            return 1;
+            ret = 1;
+            goto end;
         }

-        if(swr_init( forw_ctx) < 0)
+        if (swr_init(forw_ctx) < 0) {
             fprintf(stderr, "swr_init(->) failed\n");
-        if(swr_init(backw_ctx) < 0)
+            ret = 1;
+            goto end;
+        }
+        if (swr_init(backw_ctx) < 0) {
             fprintf(stderr, "swr_init(<-) failed\n");
+            ret = 1;
+            goto end;
+        }
                 //FIXME test planar
         setup_array(ain , array_in ,  in_sample_fmt,   SAMPLES);
         setup_array(amid, array_mid, out_sample_fmt, 3*SAMPLES);
@@ -400,9 +409,10 @@ int main(int argc, char **argv){
         fprintf(stderr, "\n");
     }

+end:
     swr_free(&forw_ctx);
     swr_free(&backw_ctx);
     av_channel_layout_uninit(&in_ch_layout);
     av_channel_layout_uninit(&out_ch_layout);
-    return 0;
+    return ret;
 }