Commit 9833a406 authored by Vittorio Giovara's avatar Vittorio Giovara

examples: Properly free AVCodecContext

parent 0e0538ae
...@@ -213,8 +213,7 @@ static void audio_encode_example(const char *filename) ...@@ -213,8 +213,7 @@ static void audio_encode_example(const char *filename)
av_freep(&samples); av_freep(&samples);
av_frame_free(&frame); av_frame_free(&frame);
avcodec_close(c); avcodec_free_context(&c);
av_free(c);
} }
/* /*
...@@ -305,8 +304,7 @@ static void audio_decode_example(const char *outfilename, const char *filename) ...@@ -305,8 +304,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
fclose(outfile); fclose(outfile);
fclose(f); fclose(f);
avcodec_close(c); avcodec_free_context(&c);
av_free(c);
av_frame_free(&decoded_frame); av_frame_free(&decoded_frame);
} }
...@@ -428,8 +426,7 @@ static void video_encode_example(const char *filename) ...@@ -428,8 +426,7 @@ static void video_encode_example(const char *filename)
fwrite(endcode, 1, sizeof(endcode), f); fwrite(endcode, 1, sizeof(endcode), f);
fclose(f); fclose(f);
avcodec_close(c); avcodec_free_context(&c);
av_free(c);
av_freep(&picture->data[0]); av_freep(&picture->data[0]);
av_frame_free(&picture); av_frame_free(&picture);
printf("\n"); printf("\n");
...@@ -565,8 +562,7 @@ static void video_decode_example(const char *outfilename, const char *filename) ...@@ -565,8 +562,7 @@ static void video_decode_example(const char *outfilename, const char *filename)
fclose(f); fclose(f);
avcodec_close(c); avcodec_free_context(&c);
av_free(c);
av_frame_free(&picture); av_frame_free(&picture);
printf("\n"); printf("\n");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment