diff options
author | Lim Siew Hoon <siew.hoon.lim@intel.com> | 2016-07-01 11:13:22 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2016-08-22 13:04:29 +0800 |
commit | b6ee5d57d62999bfb4a098145f3dd8ebcff954c2 (patch) | |
tree | cfeef1ac2945c3933345afbc6471d28caf22d803 | |
parent | 466dde116b125a368fc216af6b488d4d92baf948 (diff) | |
download | libva-b6ee5d57d62999bfb4a098145f3dd8ebcff954c2.tar.gz |
add assert check for potential NULL issue in test/encode/
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
(cherry picked from commit 1199b16ebd6488734d43c8d962d1d2d7eb42a37a)
-rw-r--r-- | test/encode/avcenc.c | 2 | ||||
-rw-r--r-- | test/encode/h264encode.c | 2 | ||||
-rw-r--r-- | test/encode/jpegenc_utils.h | 2 | ||||
-rw-r--r-- | test/encode/mpeg2vaenc.c | 1 |
4 files changed, 7 insertions, 0 deletions
diff --git a/test/encode/avcenc.c b/test/encode/avcenc.c index 74729fb..d5f2bd5 100644 --- a/test/encode/avcenc.c +++ b/test/encode/avcenc.c @@ -953,6 +953,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; } @@ -990,6 +991,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; 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; diff --git a/test/encode/jpegenc_utils.h b/test/encode/jpegenc_utils.h index e003c7e..bb00c8b 100644 --- a/test/encode/jpegenc_utils.h +++ b/test/encode/jpegenc_utils.h @@ -65,6 +65,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; } @@ -105,6 +106,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; diff --git a/test/encode/mpeg2vaenc.c b/test/encode/mpeg2vaenc.c index f49af27..fd9c5ca 100644 --- a/test/encode/mpeg2vaenc.c +++ b/test/encode/mpeg2vaenc.c @@ -831,6 +831,7 @@ mpeg2enc_alloc_va_resources(struct mpeg2enc_context *ctx) max_entrypoints = vaMaxNumEntrypoints(ctx->va_dpy); entrypoint_list = malloc(max_entrypoints * sizeof(VAEntrypoint)); + assert(entrypoint_list); vaQueryConfigEntrypoints(ctx->va_dpy, ctx->profile, entrypoint_list, |