Normalization of a quotient ring of polynomial rings (Reid, Exercise 4.6)

(In the following $x,y$ denote the residue classes of $X,Y$ modulo the ideal $(Y^2-f)$.)

The field of fractions of $B$ is $K=k(x,y)$ and every element $t\in K$ can be written as $t=a+by$ with $a,b\in k(x)$. Obviously $t$ is a root of the polynomial $p_t(T)=T^2-2aT+a^2-b^2f$ which belongs to $k(x)[T]$. Since $x$ is algebraically independent over $k$, by Gauss' Lemma we can conclude that $t$ is integral over $A$ if and only if $p_t$ has the coefficients in $k[x]$. Now we assume $\operatorname{char}k\ne2$. Then we get $p_t\in k[x][T]$ if and only if $a\in k[x]$ and $b^2f\in k[x]$. If write $f=g^2h$ with $h$ square free we can easily get the integral closure of $B$: $k[x]+k[x]\frac{y}{g}$.