If we break out of the loop before we attempt to allocate again, then we double free the memory pointed to by `name_path`. Found by Static Analysis: Sonar Cloud