swr-test: check pointers before use

Fixes: CID733807, CID733806
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/6/head
Michael Niedermayer 12 years ago
parent 8227d36bd3
commit dd3e5baa59
  1. 12
      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, 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, out_ch_layout, out_sample_fmt, out_sample_rate,
0, 0); 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) if(swr_init( forw_ctx) < 0)
fprintf(stderr, "swr_init(->) failed\n"); fprintf(stderr, "swr_init(->) failed\n");
if(swr_init(backw_ctx) < 0) if(swr_init(backw_ctx) < 0)
fprintf(stderr, "swr_init(<-) failed\n"); 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 //FIXME test planar
setup_array(ain , array_in , in_sample_fmt, SAMPLES); setup_array(ain , array_in , in_sample_fmt, SAMPLES);
setup_array(amid, array_mid, out_sample_fmt, 3*SAMPLES); setup_array(amid, array_mid, out_sample_fmt, 3*SAMPLES);

Loading…
Cancel
Save