Skip to content

Commit

Permalink
fixed calloc typo
Browse files Browse the repository at this point in the history
  • Loading branch information
DomPeliniAerospike committed May 29, 2024
1 parent 29934d3 commit b722667
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/include/dynamic_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ typedef struct bytes_dynamic_pool {
static inline void dynamic_pool_malloc_block(as_dynamic_pool *dynamic_pool,
as_error *err)
{
dynamic_pool->pool[dynamic_pool->block_id] = (as_bytes *)malloc(sizeof(as_bytes) * dynamic_pool->current_block_size);
dynamic_pool->pool[dynamic_pool->block_id] = (as_bytes *)cf_malloc(sizeof(as_bytes) * dynamic_pool->current_block_size);
if (dynamic_pool->pool[dynamic_pool->block_id] == NULL) {
as_error_update(err, AEROSPIKE_ERR,
"Failed to allocated memory for dynamic_pool");
Expand Down Expand Up @@ -54,7 +54,7 @@ static inline void dynamic_pool_expand_pool_if_needed(as_dynamic_pool *dynamic_p
static inline void dynamic_pool_create_pool(as_dynamic_pool *dynamic_pool,
as_error *err)
{
dynamic_pool->pool = (as_bytes **)malloc(
dynamic_pool->pool = (as_bytes **)cf_malloc(
AS_DYNAMIC_POOL_POINTER_BLOCK_SIZE * sizeof(as_bytes *));
if (dynamic_pool->pool == NULL) {
as_error_update(err, AEROSPIKE_ERR,
Expand Down
2 changes: 1 addition & 1 deletion src/main/serializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void execute_user_callback(user_serializer_callback *user_callback_info,
Py_ssize_t len;

py_val = (char *)PyUnicode_AsUTF8AndSize(py_return, &len);
uint8_t* heap_b = (uint8_t *)calloc((uint32_t) len);
uint8_t* heap_b = (uint8_t *)cf_calloc((uint32_t) len, sizeof(uint8_t));
memcpy(heap_b, py_val, (uint32_t) len);
as_bytes_init_wrap(*bytes, heap_b, (int32_t) len, allocate_buffer);

Expand Down

0 comments on commit b722667

Please sign in to comment.