I'm citing Risken, "The Fokker-Planck equation", 2nd edition, at page 70-71:
To derive (...) we need the generalized Cauchy-Schwarz inequality \begin{equation}\tag{1} \left(\int_{-\infty}^{+\infty}f(x)g(x)h(x)\mathrm{d}x\right)^2\leq\int_{-\infty}^{+\infty}f^2(x) h(x)\mathrm{d}x\int_{-\infty}^{+\infty}g^2(x) h(x)\mathrm{d}x \end{equation} which holds for any arbitrary functions $f(x)$ and $g(x)$, and for non-negative $h(x)$
But... how can this be true? The only thing he says is
$$\tag{2}\int_{-\infty}^{+\infty}\left(f(x) g(y) - f(y) g (x)\right)^2 h(x)h(y) \mathrm{d}x\mathrm{d}y \geq 0 $$
What if both the left and the right-hand side of $(1)$ are infinite (and they may as well be, since $f$ and $g$ are arbitrary)? Two infinities cannot be ordered, $\infty-\infty$ is neither positive nor negative, it's just an indeterminate form
The usual Cauchy-Schwarz on the real line says that if $F,G:\Bbb{R}\to\Bbb{C}$ are any measurable functions then \begin{align} \int_{\Bbb{R}}|F(x)G(x)|\,dx&\leq \sqrt{\int_{\Bbb{R}}|F(x)|^2\,dx} \sqrt{\int_{\Bbb{R}}|G(x)|^2\,dx}. \end{align} Here, we adopt the convention that $0\cdot\infty=0$ and for any $a\in (0,\infty]$, $a\cdot\infty=\infty$, and $\sqrt{\infty}=\infty^2=\infty$. Built into this inequality is the fact that if the right hand side is finite, then so is the left hand side. Also, if the left hand side is infinite, then so is the right hand side. So, this is a proper inequality in the extended sense of $[0,\infty]$.
To prove this, we have a few cases
Finally, to get the ‘generalized’ version quoted, you simply apply this usual Cauchy-Schwarz with $F=f\sqrt{h}$ and $G=g\sqrt{h}$ and square both sides.