From b6ee5d57d62999bfb4a098145f3dd8ebcff954c2 Mon Sep 17 00:00:00 2001 From: Lim Siew Hoon Date: Fri, 1 Jul 2016 11:13:22 +0800 Subject: add assert check for potential NULL issue in test/encode/ Signed-off-by: Lim Siew Hoon (cherry picked from commit 1199b16ebd6488734d43c8d962d1d2d7eb42a37a) --- test/encode/h264encode.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/encode/h264encode.c') diff --git a/test/encode/h264encode.c b/test/encode/h264encode.c index 9e20919..3d7b610 100644 --- a/test/encode/h264encode.c +++ b/test/encode/h264encode.c @@ -197,6 +197,7 @@ bitstream_start(bitstream *bs) { bs->max_size_in_dword = BITSTREAM_ALLOCATE_STEPPING; bs->buffer = calloc(bs->max_size_in_dword * sizeof(int), 1); + assert(bs->buffer); bs->bit_offset = 0; } @@ -234,6 +235,7 @@ bitstream_put_ui(bitstream *bs, unsigned int val, int size_in_bits) if (pos + 1 == bs->max_size_in_dword) { bs->max_size_in_dword += BITSTREAM_ALLOCATE_STEPPING; bs->buffer = realloc(bs->buffer, bs->max_size_in_dword * sizeof(unsigned int)); + assert(bs->buffer); } bs->buffer[pos + 1] = val; -- cgit v1.2.1