  Consider a field $k$ of characteristic $0$, not necessarily algebraically
closed, and a fixed algebraic curve $f=0$ defined by a tame polynomial $f\in
k[x,y]$ with only quasi-homogeneous singularities. We prove that the space of
holomorphic foliations in the plane ${mathbb A}^2_\k$ having $f=0$ as a fixed
invariant curve is generated as $k[x,y]$-module by at most four elements, three
of them are the trivial foliations $fdx,fdy$ and $df$. Our proof is algorithmic
and constructs the fourth foliation explicitly. Using Serre's GAGA and
Quillen-Suslin theorem, we show that for a suitable field extension $K$ of $k$
such a module over $K[x,y]$ is actually generated by two elements, and
therefore, such curves are free divisors in the sense of K. Saito. After
performing Groebner basis for this module, we observe that in many well-known
examples, $K=k$.
