TODO: fail in select malloc