From: Antonio Ospite Date: Tue, 20 Mar 2012 21:59:03 +0000 (+0100) Subject: examples: set proper return codes in am7xxx-play X-Git-Tag: v0.1.0~1^2~10 X-Git-Url: https://git.ao2.it/libam7xxx.git/commitdiff_plain/b19775ece86f40df15ffadcb358c8896bc847482?ds=sidebyside;hp=-c examples: set proper return codes in am7xxx-play Set the return codes explicitly on the error path of functions not returning an int error value. --- b19775ece86f40df15ffadcb358c8896bc847482 diff --git a/examples/am7xxx-play.c b/examples/am7xxx-play.c index a661758..56fd8b2 100644 --- a/examples/am7xxx-play.c +++ b/examples/am7xxx-play.c @@ -291,6 +291,7 @@ static int am7xxx_play(const char *input_format_string, picture_raw = avcodec_alloc_frame(); if (picture_raw == NULL) { fprintf(stderr, "cannot allocate the raw picture frame!"); + ret = -ENOMEM; goto cleanup_output; } @@ -298,6 +299,7 @@ static int am7xxx_play(const char *input_format_string, picture_scaled = avcodec_alloc_frame(); if (picture_scaled == NULL) { fprintf(stderr, "cannot allocate the scaled picture!\n"); + ret = -ENOMEM; goto cleanup_picture_raw; } @@ -308,6 +310,7 @@ static int am7xxx_play(const char *input_format_string, out_buf = av_malloc(out_buf_size * sizeof(uint8_t)); if (out_buf == NULL) { fprintf(stderr, "cannot allocate output data buffer!\n"); + ret = -ENOMEM; goto cleanup_picture_scaled; } @@ -329,6 +332,7 @@ static int am7xxx_play(const char *input_format_string, NULL, NULL, NULL); if (sw_scale_ctx == NULL) { fprintf(stderr, "cannot set up the rescaling context!\n"); + ret = -EINVAL; goto cleanup_out_buf; }