diff --git a/src/hashtable.c b/src/hashtable.c index 76214f0..0ec1ef8 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -153,11 +153,12 @@ static int hashtable_do_rehash(hashtable_t *hashtable) list_t *list, *next; pair_t *pair; size_t i, index, new_size, new_order; + struct hashtable_bucket *new_buckets; new_order = hashtable->order + 1; new_size = hashsize(new_order); - struct hashtable_bucket *new_buckets = jsonp_malloc(new_size * sizeof(bucket_t)); + new_buckets = jsonp_malloc(new_size * sizeof(bucket_t)); if(!new_buckets) return -1; diff --git a/test/suites/api/test_memory_funcs.c b/test/suites/api/test_memory_funcs.c index ac58809..7cb4b73 100644 --- a/test/suites/api/test_memory_funcs.c +++ b/test/suites/api/test_memory_funcs.c @@ -25,11 +25,12 @@ static void create_and_free_complex_object() static void create_and_free_object_with_oom() { + int i; + char key[4]; json_t *obj = json_object(); - for (int i = 0; i < 10; i++) + for (i = 0; i < 10; i++) { - char key[4]; snprintf(key, sizeof key, "%d", i); json_object_set_new(obj, key, json_integer(i)); }