start fixing memory leaks

thus far, i've gotten it from:

```
==8904==    definitely lost: 215 bytes in 7 blocks
==8904==    indirectly lost: 1,099 bytes in 26 blocks
==8904==      possibly lost: 0 bytes in 0 blocks
==8904==    still reachable: 0 bytes in 0 blocks
==8904==         suppressed: 0 bytes in 0 blocks
```

to:

```
==8869== LEAK SUMMARY:
==8869==    definitely lost: 80 bytes in 7 blocks
==8869==    indirectly lost: 0 bytes in 0 blocks
==8869==      possibly lost: 0 bytes in 0 blocks
==8869==    still reachable: 0 bytes in 0 blocks
==8869==         suppressed: 0 bytes in 0 blocks
```
Merge pull request #11 from qute/wip/fix-memory-leaks

start fixing memory leaks