OSDN Git Service

add assert check for potential NULL issue in test/encode/
authorLim Siew Hoon <siew.hoon.lim@intel.com>
Fri, 1 Jul 2016 03:13:22 +0000 (11:13 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Fri, 22 Jul 2016 08:13:20 +0000 (16:13 +0800)
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
test/encode/avcenc.c
test/encode/h264encode.c
test/encode/jpegenc_utils.h
test/encode/mpeg2vaenc.c

index 74729fb..d5f2bd5 100644 (file)
@@ -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;
index 9e20919..3d7b610 100644 (file)
@@ -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;
index e003c7e..bb00c8b 100644 (file)
@@ -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;
index f49af27..fd9c5ca 100644 (file)
@@ -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,