Skip to content
Permalink
Browse files

Correctly clean up in test

  • Loading branch information...
PJK committed Feb 2, 2019
1 parent e3537c2 commit 4065e9c65fb4b69424f650559ae70e6ade1c7be0
Showing with 3 additions and 0 deletions.
  1. +1 −0 src/cbor/arrays.c
  2. +1 −0 src/cbor/maps.c
  3. +1 −0 test/memory_allocation_test.c
@@ -59,6 +59,7 @@ bool cbor_array_push(cbor_item_t *array, cbor_item_t *pushee) {
/* Exponential realloc */
if (metadata->end_ptr >= metadata->allocated) {
// Check for overflows first
// TODO: Explicitly test this
if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, metadata->allocated)) {
return false;
}
@@ -66,6 +66,7 @@ bool _cbor_map_add_key(cbor_item_t *item, cbor_item_t *key) {
if (metadata->end_ptr >= metadata->allocated) {
/* Exponential realloc */
// Check for overflows first
// TODO: Explicitly test this
if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, metadata->allocated)) {
return false;
}
@@ -229,6 +229,7 @@ static void test_array_push(void **state) {
assert_null(array->data);
assert_int_equal(array->metadata.array_metadata.end_ptr, 0);

cbor_decref(&string);
cbor_decref(&array);
},
4, MALLOC, MALLOC, MALLOC, REALLOC_FAIL);

0 comments on commit 4065e9c

Please sign in to comment.
You can’t perform that action at this time.