do not forget to free packet, fix memleak