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

[Plugins] P044_P1WifiGateway. shouldn't this be freed at some point in PLUGIN_EXIT? #2236

Closed
Barracuda09 opened this issue Jan 14, 2019 · 5 comments
Labels
Status: Fixed Commit has been made, ready for testing Type: Bug Considered a bug

Comments

@Barracuda09
Copy link

See link:

Plugin_044_serial_buf = (char *)malloc(P044_BUFFER_SIZE);

And maybe change this to new and delete?

@TD-er
Copy link
Member

TD-er commented Jan 14, 2019

As we speak, I am updating this plugin to use the Plugin_task_data and indeed it needs to free the data.
I was even thinking about using a std::vector for this one.

@Barracuda09
Copy link
Author

I was even thinking about using a std::vector for this one.

Yes if that would be possible, I would go for that as well.

@Barracuda09
Copy link
Author

Barracuda09 commented Jan 14, 2019

And maybe use an enum (class) for this:

#define P044_DISABLED 0

EDIT you can even do it like this:
enum (class) State : byte {
Disabled,
...
};

@TD-er
Copy link
Member

TD-er commented Jan 14, 2019

I did change it to be a String, since there were already functions implemented to do just what was already available in the String class.
See: ef5f519

@TD-er TD-er added Type: Bug Considered a bug Status: Fixed Commit has been made, ready for testing labels Jan 14, 2019
TD-er added a commit to TD-er/ESPEasy that referenced this issue Feb 25, 2019
In the reverted code this was fixed in another way, so this is just a quick fix for now.
See letscontrolit#2352 and letscontrolit#2236
@TD-er
Copy link
Member

TD-er commented Feb 25, 2019

The code for the P044_P1WifiGateway is reverted to some state before my fixes of this issue.
So I added a quick fix for this memory leak.
Later we will have a proper look at the code to see what was causing the issues with the ser2net plugin.

Anyway this issue is now fixed, so I will close it.

@TD-er TD-er closed this as completed Feb 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Fixed Commit has been made, ready for testing Type: Bug Considered a bug
Projects
None yet
Development

No branches or pull requests

2 participants