This commit changes the `list_t` api so that alloc errors can be detected and worked around. Also fixes errors not found in 5cc7342
5cc7342