plugins/python: memleak fixes in test
The main problem was that string array objects were constructed differently: - if constructed by the test, then the elements were constant - if constructed by the plugin, then the elements were allocated Modified it so that now each array contains allocated strings so they can be handled similarly. For freeing, I have used the str_array_free function from the plugin, so I have linked its object into the test runner. Happy path is now free of "definitely lost" memleaks, so the test can be used for valgrind.
This commit is contained in:

committed by
Todd C. Miller

parent
ac61b5655d
commit
a3a7630ff4
@@ -64,7 +64,8 @@ create_str_array(size_t count, ...)
|
||||
|
||||
char ** result = calloc(count, sizeof(char *));
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
result[i] = va_arg(args, char *);
|
||||
const char *str = va_arg(args, char *);
|
||||
result[i] = (str == NULL ? NULL : strdup(str));
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
|
Reference in New Issue
Block a user