From: Antonio Ospite Date: Sat, 22 Nov 2014 22:58:36 +0000 (+0100) Subject: am7xxx-play: fix a possible case of use before initialization X-Git-Tag: v0.1.6~45 X-Git-Url: https://git.ao2.it/libam7xxx.git/commitdiff_plain/478203de36f03a4889699e193bd81d7fb4afbcd7?ds=inline am7xxx-play: fix a possible case of use before initialization The got_packet variable is assigned inside an internal "if" of the while loop, but it is also used in the checks at the end of the while loop, and it is possible to get to this part before having ever assigned the variable, so in order to behave correctly initialize the variable before the loop starts. --- diff --git a/examples/am7xxx-play.c b/examples/am7xxx-play.c index 2fa615a..5b2887d 100644 --- a/examples/am7xxx-play.c +++ b/examples/am7xxx-play.c @@ -354,6 +354,7 @@ static int am7xxx_play(const char *input_format_string, goto cleanup_out_buf; } + got_packet = 0; while (run) { /* read packet */ ret = av_read_frame(input_ctx.format_ctx, &in_packet);