From: Lim Siew Hoon Date: Fri, 1 Jul 2016 03:13:22 +0000 (+0800) Subject: add assert check for potential NULL issue in test/encode/ X-Git-Tag: android-x86-7.1-r1~90 X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fhardware-intel-common-libva.git;a=commitdiff_plain;h=1199b16ebd6488734d43c8d962d1d2d7eb42a37a add assert check for potential NULL issue in test/encode/ Signed-off-by: Lim Siew Hoon --- 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,