Skip to content

Fix to ensure the custom deallocator for zint_symbol is used for std::shared_ptr's too #808

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

Merged

Conversation

johngladp
Copy link
Contributor

Fixes to address issue: #807

std::unique_ptr<zint_symbol> usage is replaced with:
using unique_zint_symbol = std::unique_ptr<zint_symbol, zint_symbol_deleter>;

This permits the std::move cast used in
void Result::zint(unique_zint_symbol&& z)

{
	_zint = std::shared_ptr(std::move(z));
}

to move the customer deleter usage into the shared pointer too, std::default_delete usage only works for unique_ptr's which is why this change is needed. This prevents ASAN errors that report alloc/dealloc mismatch due to the shared_ptr usage:
image
(The image is from our internal test pipeline and is of the test that was failing when ASAN is enabled.)

@axxel
Copy link
Collaborator

axxel commented Jul 15, 2024

Thank you very much for debugging and reporting his. Could you do me a favor and drop the gitignore commit from this PR?

And the broken rust-build has nothing to do with your change but an updated rust compiler on the CI system.

@johngladp johngladp force-pushed the datapath_asan_alloc_mismatch_fix branch from 3517731 to 86e5190 Compare July 16, 2024 16:16
@johngladp
Copy link
Contributor Author

gitignore commit removed as requested. Thanks!

@axxel axxel merged commit cd11aa5 into zxing-cpp:master Jul 18, 2024
15 of 18 checks passed
@axxel
Copy link
Collaborator

axxel commented Jul 18, 2024

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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy