use proper error numbers
free mbuf on error