Remove redundant NULL check on cur cur = node, and node cannot be NULL as it is checked at the start of the function.