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

@@ -130,7 +130,7 @@ VERSION = @PACKAGE_VERSION@
TEST_PROGS = check_python_examples
CHECK_PYTHON_EXAMPLES_OBJS = check_python_examples.o iohelpers.o testhelpers.o
CHECK_PYTHON_EXAMPLES_OBJS = check_python_examples.o iohelpers.o testhelpers.o pyhelpers.lo sudo_python_debug.lo
all: python_plugin.la