Skip to content

Commit

Permalink
Add destructor to Kernel class to fix memleaks
Browse files Browse the repository at this point in the history
This for examples fixes leaks reported by
valgrind --leak-check=full ./bin/pdal  info --all ../test/data/las/simple.las
  • Loading branch information
rouault committed Sep 11, 2015
1 parent 4e377b0 commit bead179
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 1 addition & 2 deletions include/pdal/Kernel.hpp
Expand Up @@ -72,8 +72,7 @@ typedef std::shared_ptr<PointView> PointViewPtr;
class PDAL_DLL Kernel
{
public:
virtual ~Kernel()
{}
virtual ~Kernel();

// call this, to start the machine
int run(int argc, const char* argv[], const std::string& appName);
Expand Down
12 changes: 12 additions & 0 deletions src/Kernel.cpp
Expand Up @@ -71,6 +71,18 @@ Kernel::Kernel()
{}


Kernel::~Kernel()
{
for (auto & iter : m_public_options)
{
delete iter;
}
for (auto & iter : m_hidden_options)
{
delete iter;
}
}

std::ostream& operator<<(std::ostream& ostr, const Kernel& kernel)
{
ostr << " Name: " << kernel.getName() << std::endl;
Expand Down

0 comments on commit bead179

Please sign in to comment.