Refactor test_bogo.c
Properly free up memory in bogo.c