Is $x^3+x^2+x+1$ divisible by $x^3+5x^2+x$ in $\mathbb{Z}_5\left[x\right]$? (for simplicity, denote $a(x)=x^3+x^2+x+1$ and $b(x)=x^3+5x^2+x$)
My assignment asks to show that $b(x)$ does not divide $a(x)$ in $\mathbb{Z}\left[x\right]$, but rather that it does divide it in $\mathbb{Z}_5\left[x\right]$.
Long division shows that the first is obviously true, $\frac {a(x)} {b(x)}$ leaves a remainder of $r(x)=1-4x$.
But so far, I'm drawing a blank on the second. Whenever I try to use long division in this new polynomial field, I get a nonzero remainder of $r(x)=x^2+1$. (which is the remainder of the first division, with coefficients made modulo 5)
Since we're now in $\mathbb{Z}_5\left[x\right]$, $b(x)=x^3+x$ (since $5=0$) So this is true if we're using the division algorithm:
$$x^3+x^2+x+1=(1)(x^3+x)+(x^2+1)=x^3+x^2+x+1$$
Where am I having a memory leak?

I'm not sure where you had a leak, but:
$$x^3+x^2+x+1=(x+1)(x^2+1)$$
and this much is true in the integers $\;\Bbb Z\;$ , so it is also true in $\;\Bbb Z_5\;$ . It comes from noticing that $\;-1=4\pmod5\;$ is a root of the leftmost polynomial. Observe further that since $\;5=1\pmod4\;,\;\;-1\;$ is a square in this last field, so in fact
$$x^2+1=(x-2)(x+2)\pmod5= (x+3)(x+2)\pmod5$$
so in the end
$$x^3+x^2+x+1=(x+1)(x^2+1)=(x+1)(x+2)(x+3)\pmod5$$
