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(util): fixing static memleak in version-info macro #32

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

dsavitskiy
Copy link
Contributor

No description provided.

@dsavitskiy dsavitskiy force-pushed the feature/fix-mem-leak branch from 98a7f08 to f4cf93f Compare June 22, 2023 11:23
static mut BUF: Vec<u8> = Vec::new();
let s = String::from($crate::version_info!());
unsafe {
BUF.resize(s.len(), 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't a second call to this invalidate the first memory as we're resizing?
would OnceCell be more appropriate usage?

@dsavitskiy dsavitskiy force-pushed the feature/fix-mem-leak branch from f4cf93f to a1b0cea Compare June 30, 2023 14:38
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