There is a check below to see whether dag equals NULL, so this could potentially be a null pointer dereference. I think it would be sufficient to do <code>if(instance->current_dag->rank == ROOT_RANK(instance) && instance->current_dag != dag)</code>