summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2013-12-13 20:57:24 -0800
committerStefano Sabatini <stefasab@gmail.com>2013-12-14 14:02:49 +0100
commitc65fe9e9822cf2a04e5507ddbb7f99e4b6cd93e9 (patch)
tree68e89eb41407725200489b63a785f84c51f650b4 /doc
parentb242c156e5b92b44976baa0560e4b427fa1a5a81 (diff)
examples/decoding_encoding: check av_samples_get_buffer_size() return code
Fixes CID1135756. Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/decoding_encoding.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/examples/decoding_encoding.c b/doc/examples/decoding_encoding.c
index 8bfc30f43a..4d2813b052 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",