There was an error while loading. Please reload this page.
1 parent 6684250 commit 21c0d3dCopy full SHA for 21c0d3d
1 file changed
lwmem/src/lwmem/lwmem.c
@@ -239,7 +239,7 @@ prv_insert_free_block(lwmem_t* const lwobj, lwmem_block_t* nblk) {
239
* Try to find position to put new block in-between
240
* Search until all free block addresses are lower than entry block
241
*/
242
- for (prev = &(lwobj->start_block); prev != NULL && prev->next < nblk; prev = prev->next) {}
+ for (prev = &(lwobj->start_block); prev != NULL && prev->next != NULL && prev->next < nblk; prev = prev->next) {}
243
244
/* This is hard error with wrong memory usage */
245
if (prev == NULL) {
0 commit comments