BLI_linklist_free() was incorrectly taking MEM_freeN() as an argument, evidentially this works on x86 - but could cause issues later on.
add BLI_linklist_freeN() which MEM_freeN's each item.
This commit is contained in:
@@ -59,6 +59,7 @@ void BLI_linklist_prepend_arena(struct LinkNode **listp, void *ptr, struct Me
|
||||
void BLI_linklist_insert_after(struct LinkNode **listp, void *ptr);
|
||||
|
||||
void BLI_linklist_free(struct LinkNode *list, LinkNodeFreeFP freefunc);
|
||||
void BLI_linklist_freeN(struct LinkNode *list);
|
||||
void BLI_linklist_apply(struct LinkNode *list, LinkNodeApplyFP applyfunc, void *userdata);
|
||||
|
||||
#endif
|
||||
|
@@ -155,6 +155,18 @@ void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc)
|
||||
}
|
||||
}
|
||||
|
||||
void BLI_linklist_freeN(LinkNode *list)
|
||||
{
|
||||
while (list) {
|
||||
LinkNode *next = list->next;
|
||||
|
||||
MEM_freeN(list->link);
|
||||
MEM_freeN(list);
|
||||
|
||||
list = next;
|
||||
}
|
||||
}
|
||||
|
||||
void BLI_linklist_apply(LinkNode *list, LinkNodeApplyFP applyfunc, void *userdata)
|
||||
{
|
||||
for (; list; list = list->next)
|
||||
|
@@ -74,7 +74,7 @@ void BLI_memarena_use_align(struct MemArena *ma, const int align)
|
||||
|
||||
void BLI_memarena_free(MemArena *ma)
|
||||
{
|
||||
BLI_linklist_free(ma->bufs, (void (*)(void *))MEM_freeN);
|
||||
BLI_linklist_freeN(ma->bufs);
|
||||
MEM_freeN(ma);
|
||||
}
|
||||
|
||||
|
@@ -616,7 +616,7 @@ LinkNode *BLI_file_read_as_lines(const char *name)
|
||||
*/
|
||||
void BLI_file_free_lines(LinkNode *lines)
|
||||
{
|
||||
BLI_linklist_free(lines, (void (*)(void *))MEM_freeN);
|
||||
BLI_linklist_freeN(lines);
|
||||
}
|
||||
|
||||
/** is file1 older then file2 */
|
||||
|
Reference in New Issue
Block a user