fix use of uninitialized memory
fix leaks
Fix queue leak in main
fix leak of question
Fix leaks with ref counting