CLRS
CLRS copied to clipboard
fix a list infinite loop bug
imagine such code: list_t ls1 = alloc_object(1); cons(2, ls1); these code will make an infinite loop, because when alloc an object, didn't modify its next, so it naturally links with object allocated later. In this case, 2 will be next of 1, but when cons 2 and 1, 2 becomes prev of 1. to avoid this bug, fix alloc_object() function's bug by adding some statements.
Is the variable new_obj
same as new
?