Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loghandler memleak #609

Merged
merged 1 commit into from
Mar 30, 2023
Merged

Fix loghandler memleak #609

merged 1 commit into from
Mar 30, 2023

Conversation

iekashaev
Copy link
Contributor

@iekashaev iekashaev commented Mar 26, 2023

Fixed potential memleak, when using dynamic polymorphism.

For all base classes we need to use virtual destructor.

I attach example to reproduce the memleak:

class TestLogHandler : public ILogHandler {
  public:
    void log(std::string message, LogLevel level) override {
      // some log logic
    }
};

int main() {
  ILogHandler* handler = new TestLogHandler();
  delete handler;
  return 0;
}

Thanks!

Copy link
Contributor

@kiner-shah kiner-shah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find.

@mrozigor mrozigor merged commit eef1abe into CrowCpp:master Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants