[FFmpeg-cvslog] examples/decoding_encoding: check av_samples_get_buffer_size() return code
Timothy Gu
git at videolan.org
Sat Dec 14 14:04:16 CET 2013
ffmpeg | branch: master | Timothy Gu <timothygu99 at gmail.com> | Fri Dec 13 20:57:24 2013 -0800| [c65fe9e9822cf2a04e5507ddbb7f99e4b6cd93e9] | committer: Stefano Sabatini
examples/decoding_encoding: check av_samples_get_buffer_size() return code
Fixes CID1135756.
Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c65fe9e9822cf2a04e5507ddbb7f99e4b6cd93e9
---
doc/examples/decoding_encoding.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/doc/examples/decoding_encoding.c b/doc/examples/decoding_encoding.c
index 8bfc30f..4d2813b 100644
--- a/doc/examples/decoding_encoding.c
+++ b/doc/examples/decoding_encoding.c
@@ -170,6 +170,10 @@ static void audio_encode_example(const char *filename)
* we calculate the size of the samples buffer in bytes */
buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size,
c->sample_fmt, 0);
+ if (!buffer_size) {
+ fprintf(stderr, "Could not get sample buffer size\n");
+ exit(1);
+ }
samples = av_malloc(buffer_size);
if (!samples) {
fprintf(stderr, "Could not allocate %d bytes for samples buffer\n",
More information about the ffmpeg-cvslog
mailing list