summaryrefslogtreecommitdiff
path: root/libswresample/swresample-test.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-16 19:38:08 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-16 19:39:25 +0200
commitdd3e5baa59964d0e98ff94b159684d03db32553e (patch)
tree9bdbec1e308ad90af6ef3ef437a1854504a81dae /libswresample/swresample-test.c
parent8227d36bd3569efe0f1a4e3ad877e516497666a4 (diff)
downloadffmpeg-dd3e5baa59964d0e98ff94b159684d03db32553e.tar.gz
swr-test: check pointers before use
Fixes: CID733807, CID733806 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/swresample-test.c')
-rw-r--r--libswresample/swresample-test.c12
1 files changed, 8 insertions, 4 deletions
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);