Fixes and enhancements after gdb debugging

- fixed several memory problems related to my noob understanding
- added build artifacts to .gitginore
- added pcap_close()
- extended pcap_test.php
- cleaned up (and probably created more mess)