Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the default minimum block array length to 1 in pool initialization #560

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions frame/base/bli_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ void bli_pool_init
// Make sure that block_ptrs_len is at least num_blocks.
block_ptrs_len = bli_max( block_ptrs_len, num_blocks );

// Handle the case where block_ptrs_len is zero, we explicitly set it to 1,
// to avoid any malloc() with zero size, whose behavior is not fixed, and
// also to prevent from falling into any further memory corruption bug.
block_ptrs_len = ( block_ptrs_len == 0 ) ? 1 : block_ptrs_len;

#ifdef BLIS_ENABLE_MEM_TRACING
printf( "bli_pool_init(): allocating block_ptrs (length %d): ",
( int )block_ptrs_len );
Expand Down