Contour integration problem with sin and cos so I'm revising contour integration for an upcoming complex analysis exam. I have been asked to integrate $$\int_0^{2\pi}\frac{\sin^2x}{a+b  \cos x}dx$$
I thought the sensible thing to do here would be to substitute in $z=e^{ix}$ and take a contour integral around the unit circle, call this path $\ast$ so that my integral becomes $$\frac{1}{2i}Re(\int_\ast\frac{1-z^2}{az+bz^2}dz)$$
Then, letting $f(z)=\frac{1-z^2}{az+bz^2}$, I thought the function had simple poles at $z=0$ with residue $\frac{1}{a}$ and another simple pole at $z=\frac{-a}{b}$ with residue $\frac{a}{b^2}-\frac{1}{a}$ and thus I get the that $$Re(\int_\ast\frac{1-z^2}{az+bz^2}dz)=2i(2\pi i)\frac{a}{b^2}=-4\pi(\frac{a}{b^2})$$ which is not the answer given, that is: $=\frac{2\pi}{b^2}[a-\sqrt{a^2-b^2}]$,but I can't work out why. 
Any help appreciated, thank you in advance. 

$$
\begin{align}
\int_0^{2\pi}\frac{\color{#C00}{\sin^2(x)}}{\color{#090}{a+b\cos(x)}}\,\color{#00F}{\mathrm{d}x}
&=\oint\frac{\color{#C00}{-\frac{z^4-2z^2+1}{4z^2}}}{\color{#090}{\frac{bz^2+2az+b}{2z}}}\color{#00F}{\frac{\mathrm{d}z}{iz}}\\
&=-\frac1{2i}\oint\frac{z^4-2z^2+1}{bz^2+2az+b}\,\frac{\mathrm{d}z}{z^2}
\end{align}
$$
The residue of $\frac{z^4-2z^2+1}{bz^2+2az+b}\frac1{z^2}$ at $z=\frac{-a\pm\sqrt{a^2-b^2}}b$ (simple poles) is $\pm\frac{2\sqrt{a^2-b^2}}{b^2}$ and the residue at $z=0$ (degree $2$ pole) is $-\frac{2a}{b^2}$. Assuming $a\gt0$, we get $2\pi i$ times the sum of the residues inside the unit circle, $\frac{-a+\sqrt{a^2-b^2}}b$ and $0$, to be
$$
\int_0^{2\pi}\frac{\sin^2(x)}{a+b\cos(x)}\,\mathrm{d}x=2\pi\frac{a-\sqrt{a^2-b^2}}{b^2}
$$
