net.c: Fix memory leak introduced in previous commit