Fixed various bugs and leaks in lirc mode

Important changes:
1. The use-lirc settings has been renamed to hw-mode. Three hardware modes are now supported:
- "module": use the lirc_rpi kernel module
- "gpio": use direct GPIO access through wiringPi
- "none": don't use any hardware (expecially handy for nodes)
2. The socket settings has been renamed to hw-socket.
Merge branch 'memory' of https://github.com/pilight/pilight into memory