Consider a field k ${\mathsf {k}}$ of characteristic 0 $\hskip.001pt 0$ , not necessarily algebraically closed, and a fixed algebraic curve f = 0 $f=0$ defined by a tame polynomial f ∈ k [ x , y ] $f\in {\mathsf {k}}[x,y]$ with only quasi-homogeneous singularities. We prove that the space of holomorphic foliations in the plane A k 2 $\mathbb {A}^2_{\mathsf {k}}$ having f = 0 $f=0$ as a fixed invariant curve is generated as k [ x , y ] ${\mathsf {k}}[x,y]$ -module by at most four elements, three of them are the trivial foliations f d x , f d y $fdx,fdy$ and d f $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 ${\mathsf {K}}$ of k ${\mathsf {k}}$ such a module over K [ x , y ] ${\mathsf {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 ${\mathsf {K}}={\mathsf {k}}$ .