fixed memory leak

This commit is contained in:
Harun 2021-03-26 16:13:17 +01:00
parent 1fc2b3463a
commit cc5bfec4e3
1 changed files with 4 additions and 3 deletions

View File

@ -46,7 +46,7 @@ int main(int argc, char **argv){
{ {
std::cout << "Loading movies" << std::endl; std::cout << "Loading movies" << std::endl;
std::ifstream moviesfile; std::ifstream moviesfile;
moviesfile.open("movies.txt"); moviesfile.open("transaction.txt");
std::string instruction; std::string instruction;
while (std::getline(moviesfile, instruction)) while (std::getline(moviesfile, instruction))
@ -62,7 +62,7 @@ int main(int argc, char **argv){
fprintf(stderr, "SQL error: %s\n", zErrMsg); fprintf(stderr, "SQL error: %s\n", zErrMsg);
sqlite3_free(zErrMsg); sqlite3_free(zErrMsg);
} }
delete(instructionchars);
} }
std::cout << "Done" << std::endl; std::cout << "Done" << std::endl;
} }
@ -76,8 +76,9 @@ int main(int argc, char **argv){
fprintf(stderr, "SQL error: %s\n", zErrMsg); fprintf(stderr, "SQL error: %s\n", zErrMsg);
sqlite3_free(zErrMsg); sqlite3_free(zErrMsg);
} }
delete(inputchars);
} }
} }
sqlite3_close(db); sqlite3_close(db);
return 0; return 0;
} }