* commit '9833a406d3d743d238e4cbee08ffcaa12e067dd2': examples: Properly free AVCodecContext
Unified · Split
| @@ -232,8 +232,7 @@ static void audio_encode_example(const char *filename) · 231 unmodified lines | ||
| 232 | 232 | |
| 233 | 233 | av_freep(&samples); |
| 234 | 234 | av_frame_free(&frame); |
| 235 | − avcodec_close(c); | |
| 236 | − av_free(c); | |
| 235 | + avcodec_free_context(&c); | |
| 237 | 236 | } |
| 238 | 237 | |
| 239 | 238 | /* |
| @@ -336,8 +335,7 @@ static void audio_decode_example(const char *outfilename, const char *filename) · 96 unmodified lines | ||
| 336 | 335 | fclose(outfile); |
| 337 | 336 | fclose(f); |
| 338 | 337 | |
| 339 | − avcodec_close(c); | |
| 340 | − av_free(c); | |
| 338 | + avcodec_free_context(&c); | |
| 341 | 339 | av_frame_free(&decoded_frame); |
| 342 | 340 | } |
| 343 | 341 | |
| @@ -479,8 +477,7 @@ static void video_encode_example(const char *filename, int codec_id) · 135 unmodified lines | ||
| 479 | 477 | fwrite(endcode, 1, sizeof(endcode), f); |
| 480 | 478 | fclose(f); |
| 481 | 479 | |
| 482 | − avcodec_close(c); | |
| 483 | − av_free(c); | |
| 480 | + avcodec_free_context(&c); | |
| 484 | 481 | av_freep(&frame->data[0]); |
| 485 | 482 | av_frame_free(&frame); |
| 486 | 483 | printf("\n"); |
| @@ -622,8 +619,7 @@ static void video_decode_example(const char *outfilename, const char *filename) · 135 unmodified lines | ||
| 622 | 619 | |
| 623 | 620 | fclose(f); |
| 624 | 621 | |
| 625 | − avcodec_close(c); | |
| 626 | − av_free(c); | |
| 622 | + avcodec_free_context(&c); | |
| 627 | 623 | av_frame_free(&frame); |
| 628 | 624 | printf("\n"); |
| 629 | 625 | } |