2. Given that $f(x)$ is a non-zero function defined on $\mathbf{R}$. If for any $a, b \in \mathbf{R}$, it satisfies $f(a b)=a f(b)+b f(a)$, then the function $f(x)(\quad)$.
(A) is an odd function
(B) is an even function
(C) is both an odd and an even function
(D) is neither an odd function nor an even function
2.A.

Since $f(a b)=a f(b)+b f(a)$, we have $f(-x)=f(-1 \times x)=(-1) f(x)+x f(-1)$.
Also, since $f(-1)=f(-1 \times 1)=-f(1)+f(-1)$, we get $f(1)=0$.
And $f(1)=f((-1) \times(-1))=-2 f(-1)$, we get $f(-1)=0$.
Therefore, $f(-x)=-f(x)$.
Since $f(x)$ is not identically zero on $\mathbf{R}$, $f(x)$ is an odd function.