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

MD5Builder has a potential memory leak #8472

Closed
1 task done
arkhipenko opened this issue Jul 29, 2023 · 1 comment · Fixed by #8486
Closed
1 task done

MD5Builder has a potential memory leak #8472

arkhipenko opened this issue Jul 29, 2023 · 1 comment · Fixed by #8486
Assignees
Labels
Status: To be implemented Selected for Development Type: Bug 🐛 All bugs

Comments

@arkhipenko
Copy link

Board

any

Device Description

n/a

Hardware Configuration

n/a

Version

latest master (checkout manually)

IDE Name

PlatformIO

Operating System

Windows 10

Flash frequency

40

PSRAM enabled

no

Upload speed

115200

Description

in the addStream method

bool MD5Builder::addStream(Stream & stream, const size_t maxLen)

code may return without deallocating memory, thus losing 512 bytes.

        // read data and check if we got something
        int numBytesRead = stream.readBytes(buf, readBytes);
        if(numBytesRead< 1) {
            return false;
        }

should be

        // read data and check if we got something
        int numBytesRead = stream.readBytes(buf, readBytes);
        if(numBytesRead< 1) {
            free (buf);
            return false;
        }

Sketch

n/a

Debug Message

n/a

Other Steps to Reproduce

n/a

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@arkhipenko arkhipenko added the Status: Awaiting triage Issue is waiting for triage label Jul 29, 2023
@lbernstone
Copy link
Contributor

If you edit here, it will just take a couple clicks to submit a PR.

@SuGlider SuGlider self-assigned this Aug 4, 2023
@SuGlider SuGlider added Type: Bug 🐛 All bugs Status: To be implemented Selected for Development and removed Status: Awaiting triage Issue is waiting for triage labels Aug 4, 2023
@SuGlider SuGlider linked a pull request Aug 4, 2023 that will close this issue
@SuGlider SuGlider closed this as completed Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: To be implemented Selected for Development Type: Bug 🐛 All bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants