* commit '9833a406d3d743d238e4cbee08ffcaa12e067dd2': examples: Properly free AVCodecContext
Showing the changes to doc/examples/decoding_encoding.c (1 of 1 file). Show all
Unified · Split
| @@ -232,8 +232,7 @@ static void audio_encode_example(const char *filename) · 231 unmodified lines | |||
| 232 | 232 | ||
| 233 | av_freep(&samples); | 233 | av_freep(&samples); |
| 234 | av_frame_free(&frame); | 234 | av_frame_free(&frame); |
| 235 | avcodec_close(c); | 235 | avcodec_free_context(&c); |
| 236 | av_free(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 | fclose(outfile); | 335 | fclose(outfile); |
| 337 | fclose(f); | 336 | fclose(f); |
| 338 | 337 | ||
| 339 | avcodec_close(c); | 338 | avcodec_free_context(&c); |
| 340 | av_free(c); | ||
| 341 | av_frame_free(&decoded_frame); | 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 | fwrite(endcode, 1, sizeof(endcode), f); | 477 | fwrite(endcode, 1, sizeof(endcode), f); |
| 480 | fclose(f); | 478 | fclose(f); |
| 481 | 479 | ||
| 482 | avcodec_close(c); | 480 | avcodec_free_context(&c); |
| 483 | av_free(c); | ||
| 484 | av_freep(&frame->data[0]); | 481 | av_freep(&frame->data[0]); |
| 485 | av_frame_free(&frame); | 482 | av_frame_free(&frame); |
| 486 | printf("\n"); | 483 | printf("\n"); |
| @@ -622,8 +619,7 @@ static void video_decode_example(const char *outfilename, const char *filename) · 135 unmodified lines | |||
| 622 | 619 | ||
| 623 | fclose(f); | 620 | fclose(f); |
| 624 | 621 | ||
| 625 | avcodec_close(c); | 622 | avcodec_free_context(&c); |
| 626 | av_free(c); | ||
| 627 | av_frame_free(&frame); | 623 | av_frame_free(&frame); |
| 628 | printf("\n"); | 624 | printf("\n"); |
| 629 | } | 625 | } |