Skip to content

Commit

Permalink
correct freeing of memory
Browse files Browse the repository at this point in the history
  • Loading branch information
gisogrimm committed Dec 18, 2024
1 parent a0d4d71 commit a15ca7e
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/ov-client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,24 +212,29 @@ int main(int argc, char** argv)
throw ErrMsg("frontend protocol \"ds\" is not yet implemented");
break;
}
if(verbose)
std::cout << "starting services\n";
ovclient->start_service();
while(!quit_app) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
if(ovclient->is_going_to_stop()) {
quit_app = true;
try {
if(verbose)
std::cout << "starting services\n";
ovclient->start_service();
while(!quit_app) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
if(ovclient->is_going_to_stop()) {
quit_app = true;
}
}
if(verbose)
std::cout << "stopping services\n";
ovclient->stop_service();
delete ovclient;
}
catch(...) {
if(ovclient)
delete ovclient;
throw;
}
if(verbose)
std::cout << "stopping services\n";
ovclient->stop_service();
delete ovclient;
}
catch(const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
if(ovclient)
delete ovclient;
}
return 0;
}
Expand Down

0 comments on commit a15ca7e

Please # to comment.