Cleaned up main.c code. Cannot find memory leak; it appears to be in the opening of the sqlite3 database open function. Clearing the error message does not fix the problem.