Skip to content

Commit 23779ec

Browse files
committed
common: tlsf: fix block locate free twice call
1 parent bf11564 commit 23779ec

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

common/tlsf.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,13 @@ static block_header_t* block_locate_free(control_t* control, size_t size)
606606
block_header_t *block;
607607

608608
block = __block_locate_free(control, size);
609-
if (!block && size && control->request_store)
610-
control->request_store(tlsf_cast(tlsf_t, control), size);
609+
if (block)
610+
return block;
611+
612+
if (!control->request_store || !size)
613+
return NULL;
614+
615+
control->request_store(tlsf_cast(tlsf_t, control), size);
611616

612617
return __block_locate_free(control, size);
613618
}

0 commit comments

Comments
 (0)