Does $\int_a^b f'(\gamma(t))\gamma'(t)\,dt$ depend on the path for meromorphic functions? Given a meromorphic function $f:\mathbb C\to\mathbb C$ and a smooth curve $\gamma:[a,b]\to\Gamma\subset\mathbb C$ with $\gamma(a)\neq\gamma(b)$, I am tempted to think the fundamental theorem of calculus yields
$$\int_a^b\underbrace{f'(\gamma(t))\gamma'(t)\,dt}_{=df} = f(\gamma(t))\Big|_{t=a}^b (*)$$
independently of the chosen path. However, taking a closed integral through both $\gamma(a)$ and $\gamma(b)\neq\gamma(a)$, the residue theorem $\oint f'(\gamma(t))\gamma'(t)\,dt = 2\pi i\sum_k\operatorname{Res}_k(f')$ proves me wrong when the closed curve surrounds a singularity of $f'$ since the two paths connecting $\gamma(a)$ and $\gamma(b)$ would otherwise cancel out the residue. So now my question is:
What correction term needs to be added to $(*)$? Can that be fixed at all, or did I miss something?

Your argument using the fundamental theorem of calculus is correct. In fact, the residue of the derivative of a meromorphic function is zero at all its poles (which follows exactly from the fundamental theorem of calculus).
Another way to see it is to look at the Laurent series. If $f$ is holomorphic on a punctured disc $0 < |z-a| < r$, the only obstruction to $f$ having an anti-derivative is if the Laurent series has a non vanishing $(z-a)^{-1}$ term.
