Skip to content

Commit

Permalink
fixed segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
havraji6 committed Feb 11, 2021
1 parent d9c1693 commit aedef77
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ struct WorkPipeline {
FlowCache *plugin;
std::thread *thread;
std::promise<StorageStats> *promise;
plugins_t plugins;
std::vector<FlowCachePlugin *> plugins;
} storage;
ipx_ring_t *queue;
};
Expand Down Expand Up @@ -981,12 +981,11 @@ int main(int argc, char *argv[])
flowcache,
new std::thread(storage_thread, flowcache, input_queue, storage_stats),
storage_stats,
{}
plugins
},
input_queue
};
pipelines.push_back(tmp);
pipelines[pipelines.size() - 1].storage.plugins.plugins = plugins;
}

while (!stop) {
Expand Down Expand Up @@ -1040,6 +1039,9 @@ int main(int argc, char *argv[])
for (unsigned i = 0; i < pipelines.size(); i++) {
pipelines[i].storage.thread->join();
pipelines[i].storage.plugin->finish();
for (unsigned j = 0; j < pipelines[i].storage.plugins.size(); j++) {
delete pipelines[i].storage.plugins[j];
}
}

terminate_export = 1;
Expand Down

0 comments on commit aedef77

Please sign in to comment.