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:
Robert Manner
2020-01-28 13:27:49 +01:00
committed by Todd C. Miller
parent ac61b5655d
commit a3a7630ff4
4 changed files with 48 additions and 42 deletions

View File

@@ -166,7 +166,7 @@ int verify_str_set(char **actual_set, char **expected_set, const char *actual_va
do { \
char **expected_set = create_str_array(__VA_ARGS__); \
VERIFY_TRUE(verify_str_set(actual_set, expected_set, #actual_set)); \
free(expected_set); \
str_array_free(&expected_set); \
} while(false)
#endif // PYTHON_TESTHELPERS