Why is this locally free sheaf free? Let $f:X\longrightarrow Y$ be a finite, flat morphism of schemes. Then, we know that $f_*\mathcal{O}_X$ is flat over $Y$, and also that $f_*\mathcal{O}_X$ is a coherent $\mathcal{O}_Y$ module. 
We know from commutative algebra that, a finitely generated module $M$ over a local ring $R$ is a flat $R$-module if and only if $M$ is a free module.
From this, since $f_*\mathcal{O}_X$ is flat over $Y$ and coherent, $f_*\mathcal{O}_X$ is a locally free $\mathcal{O}_Y$ module.
But the book I am reading (Ueno), claims that $f_*\mathcal{O}_X$ is free as well. Why is this? I am not able to get it.

Any help will be appreciated!
 A: I think it's just a typo in Ueno's book. In general, the finite flat morphisms to a noetherian scheme $Y$ correspond 1:1 to quasi-coherent $\mathcal{O}_Y$-algebras whose underlying $\mathcal{O}_Y$-module is locally free of finite rank, and there is no reason to expect this module to be (globally) free.
Example: Let $I$ be a non-principal fractional ideal in a Dedekind domain $A$. Then the $A$-module $I \oplus A$ is not free (May's notes, Cor. 6.8), but locally free since $I$ is (Theorem 5.1), and carries the structure of an $A$-algebra with $I^2=0$. Now take $\mathrm{Spec}(A \oplus I) \to \mathrm{Spec}(A)$.
A: The sheaf $f_*\mathcal{O}_X$ needn't be free even for $f:X\to Y$ a finite flat morphism of smooth varieties over a field $k$.   
For example, to a smooth hypersurface $B\subset \mathbb  P^n_k$ of degree $d$ one associates a finite flat morphism $f:X\to Y=\mathbb  P^n_k$ ( a so called n-cyclic covering of $\mathbb  P^n$) with branch-locus $B$ ( meaning that  the restricted morphism $X\setminus f^{-1}(B)\to Y\setminus B$ is  an étale covering of degree $d$) .
One then has the formula $$ f_*\mathcal{O}_X=\oplus_{j=0}^{d-1}\mathcal O_{\mathbb  P^n} (-j)                        $$ A  reference is the book Compact Complex surfaces by  Barth, Hulek, Peters, Van de Ven, Chapter I, Section 17.
