Skip to content

Commit f2ab25d

Browse files
authored
Merge pull request ruby#37 from Shopify/flavorjones-fix-add-incoming-malloc-size
fix: ensure add_incoming allocates the proper length memory
2 parents ee6009b + be5c657 commit f2ab25d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ujit_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static void add_block_version(blockid_t blockid, block_t* block)
172172
static void add_incoming(block_t* p_block, uint32_t branch_idx)
173173
{
174174
// Add this branch to the list of incoming branches for the target
175-
uint32_t* new_list = malloc(sizeof(uint32_t) * p_block->num_incoming + 1);
175+
uint32_t* new_list = malloc(sizeof(uint32_t) * (p_block->num_incoming + 1));
176176
memcpy(new_list, p_block->incoming, p_block->num_incoming);
177177
new_list[p_block->num_incoming] = branch_idx;
178178
p_block->incoming = new_list;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy