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

Preamble mem leak was fixed #162

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

MadVitaliy
Copy link
Contributor

Preamble's assign operator does not delete allocated memory before assigning nullptr to pointer. After the fix an allocated memory is reused.

@@ -63,7 +63,6 @@ class GDCM_EXPORT Preamble
}
Preamble& operator=(Preamble const &)
{
Internal = nullptr;
Create();
return *this;
Copy link

Choose a reason for hiding this comment

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

shouldn't we also copy characters from Internal?

Copy link
Contributor Author

@MadVitaliy MadVitaliy Oct 5, 2023

Choose a reason for hiding this comment

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

To follow the current logic, we should not. Both copy operator and copy assign operator do not actually copy any data but fill allocated memory in some curtain fixed way. Moreover, these operators do not have an explicit input object.

Thus, let's wait for author's response.

Anyway, it not a big deal to add true copying, if it will be needed.

@malaterre malaterre merged commit 15a4353 into malaterre:master Oct 30, 2023
2 checks passed
@malaterre
Copy link
Owner

Thanks !

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