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

RRD files creation async : memory leak #661

Closed
ymettier opened this issue Jun 25, 2014 · 0 comments
Closed

RRD files creation async : memory leak #661

ymettier opened this issue Jun 25, 2014 · 0 comments
Labels
Bug

Comments

@ymettier
Copy link
Contributor

@ymettier ymettier commented Jun 25, 2014

Hello,

I found a memory leak when you create RRD files with rrdcached plugin enabled with CreateFilesAsync true

LoadPlugin rrdcached
<Plugin rrdcached>
[...]
    CreateFiles true
    CreateFilesAsync true
[...]
</Plugin>

Description of the bug

Source file : utils_rrdcreate.c

Function srrd_create_args_create() starts with a malloc() call :

  args = malloc (sizeof (*args));

Then, for all the life of the args variable, if something goes wrong, srrd_create_args_destroy (args) is called.

However, the args variable is never freed.

Suggestion for a fix

Replace all occurrence of

    srrd_create_args_destroy (args);

with

    srrd_create_args_destroy (args); free(args); args = NULL;

Patch / Pull Request
I'm not writing a patch/pull request for this easy fix because there is another problem with this code, best described in #640 with Pull Request attached.
I updated my PR #640 with the fix for this bug/memory leak.

@mfournier mfournier added the Bug label Jul 24, 2014
octo added a commit that referenced this issue Sep 2, 2014
Thanks to Yves Mettier for pointing this out!

Fixes: #661
octo referenced this issue in ymettier/collectd Sep 10, 2014
@octo octo closed this Sep 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.