Consider the Klein bottle $K$ with flat metric. I'm thinking of $K$ as a square where the left and right sides are identified in the "right" way (like on the torus), while the top and bottom are identified in the "wrong" way (like on $\mathbb{R}P^2$). In this picture, geodesics are straight lines that wrap around depending on the identifications on the edges.
Take your basepoint $p$ to be the center of the square. Consider the geodesic $\gamma$ emanating from $p$ with slope 1. So, it starts in the middle of the square moving towards the top right corner. After it gets to the top right corner, due to the identifications we're making, it becomes a straight line emanating from the bottom right corner with slope -1 until it eventually hits $p$ again, i.e., it closes up. However, it is not a closed geodesic because it makes a corner at $p$.
Further, I claim no other geodesic emanating from $p$ is in the same homotopy class as $\gamma$. To see this, work in the univeral cover, $\mathbb{R}^2$ (thought of as being tiled by squares with identification arrows as approrpriate, with corners on integer lattice points). Geodesics are still straight lines, but now there is a unique straight line from $(\frac{1}{2},\frac{1}{2})$ to $(\frac{3}{2},\frac{3}{2})$, given by lifting $\gamma$.
This means the Cartan's theorem fails on based loops, at least in this particular case.