From dd3e5baa59964d0e98ff94b159684d03db32553e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 16 Oct 2012 19:38:08 +0200 Subject: swr-test: check pointers before use Fixes: CID733807, CID733806 Signed-off-by: Michael Niedermayer --- libswresample/swresample-test.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'libswresample/swresample-test.c') diff --git a/libswresample/swresample-test.c b/libswresample/swresample-test.c index 4a0728c8e7..7260a767c2 100644 --- a/libswresample/swresample-test.c +++ b/libswresample/swresample-test.c @@ -304,14 +304,18 @@ int main(int argc, char **argv){ backw_ctx = swr_alloc_set_opts(backw_ctx, in_ch_layout, in_sample_fmt, in_sample_rate, out_ch_layout, out_sample_fmt, out_sample_rate, 0, 0); + if(!forw_ctx) { + fprintf(stderr, "Failed to init forw_cts\n"); + return 1; + } + if(!backw_ctx) { + fprintf(stderr, "Failed to init backw_ctx\n"); + return 1; + } if(swr_init( forw_ctx) < 0) fprintf(stderr, "swr_init(->) failed\n"); if(swr_init(backw_ctx) < 0) fprintf(stderr, "swr_init(<-) failed\n"); - if(!forw_ctx) - fprintf(stderr, "Failed to init forw_cts\n"); - if(!backw_ctx) - fprintf(stderr, "Failed to init backw_ctx\n"); //FIXME test planar setup_array(ain , array_in , in_sample_fmt, SAMPLES); setup_array(amid, array_mid, out_sample_fmt, 3*SAMPLES); -- cgit v1.2.1