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 Some Memory Leaks #170

Merged
merged 1 commit into from
Aug 3, 2019
Merged

Fix Some Memory Leaks #170

merged 1 commit into from
Aug 3, 2019

Conversation

ax3l
Copy link
Contributor

@ax3l ax3l commented Aug 3, 2019

Fixing some memory leaks :)

Found via gcc's -fsanitize=address sanitizer. (There are more, but that's what I catched so far ;) )

Fixing some memory leaks :)
@ax3l ax3l force-pushed the fix-someMemleaks branch from 3ab8ec5 to bfff0df Compare August 3, 2019 04:33
@JulianKunkel JulianKunkel merged commit 5e6a034 into hpc:master Aug 3, 2019
@ax3l ax3l deleted the fix-someMemleaks branch August 4, 2019 22:48
@ax3l
Copy link
Contributor Author

ax3l commented Aug 4, 2019

Ah dang, I added a mem violation in that one. Will add another PR.

@@ -89,6 +89,7 @@ option_help * POSIX_options(void ** init_backend_options, void * init_values){
}

*init_backend_options = o;
free(o);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's wrong, sorry.

@ax3l
Copy link
Contributor Author

ax3l commented Aug 4, 2019

There is so much more in option parsing, but I can not get a real hold of it. E.g.

diff --git a/src/parse_options.c b/src/parse_options.c
index af30c36..362443d 100755
--- a/src/parse_options.c
+++ b/src/parse_options.c
@@ -550,6 +550,16 @@ IOR_test_t *ParseCommandLine(int argc, char **argv)
     option_parse(argc, argv, global_options);
     updateParsedOptions(& initialTestParams, global_options);
 
+    for (int i=1; i< global_options->module_count; i++) {
+      if(global_options->modules[i].options != NULL){
+          free(global_options->modules[i].options);
+      }
+    }
+    free(options);
+
+    free(global_options->modules);
+    free(global_options);
+
     if (initialTestParams.testscripts){
       tests = ReadConfigScript(initialTestParams.testscripts);
     }else{

@ax3l ax3l mentioned this pull request Aug 4, 2019
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