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

Memory leak #7

Closed
navossoc opened this issue Jan 10, 2016 · 2 comments
Closed

Memory leak #7

navossoc opened this issue Jan 10, 2016 · 2 comments

Comments

@navossoc
Copy link

navossoc commented Jan 10, 2016

Well, I've used this extension for less than one day.

After 4 hours running my web server runs out of memory ;)

You allocated memory and never freed it later.

In two places here:
https://github.com/AllTheDucks/hsts-iis-module/blob/d18839e99474478bf63666109e6255099092b959/module/src/module/cpp/HstsIisModule.cpp#L120
https://github.com/AllTheDucks/hsts-iis-module/blob/d18839e99474478bf63666109e6255099092b959/module/src/module/cpp/HstsIisModule.cpp#L125

TBH, I'm not sure why you alloc and free this strings on every request since they are constants.
Can't you just move it to some kind of initialization and alloc and free it once?

Besides that, I think you may have another leak here:
https://github.com/AllTheDucks/hsts-iis-module/blob/d18839e99474478bf63666109e6255099092b959/module/src/module/cpp/HstsIisModule.cpp#L277

You may need to add a call to cleanup before return.

Something like this:

pHttpResponse->Redirect(url, true, false);
cleanup();
return RQ_NOTIFICATION_FINISH_REQUEST;

I did not analyze all the source, I just gave a quick peek.

@FWest98
Copy link
Owner

FWest98 commented Jun 16, 2016

Thanks for the heads-up! I see that this is indeed a problem that needs fixing.
Currently I don't have much time (exams and stuff) and I can't get the build working (some update messed up the compilation tools). I was planning to install a fresh W10 in a few weeks, then I'll certainly look into this. I have some other things to update to this project as well.

@FWest98
Copy link
Owner

FWest98 commented Aug 29, 2016

I finally got time to fix this, and you were completely right. Those were indeed bad memory leaks so I fixed them in the most recent release, 2.2.0. Thanks for your help!

@FWest98 FWest98 closed this as completed Aug 29, 2016
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

No branches or pull requests

2 participants