Don't use test files that are not reset between runs.
Leak-fix: EvalTokenAsClass should destroy its ref even when answering no.
Leak-fix: GenericAgentDiscoverContext()'s existing_policy_server.

SetPolicyServer() takes a copy, so its caller is responsible for
disposing of the original, which ReadPolicyServerFile() built for it.
Leak-fix: Apoptosis leaked its list of owners.
Leak-fix: use WriteClose() to tidy up.

Calling StringWriterClose() and ignoring the return is always a leak.
Warn if StringWriterClose() return is ignored (hence leaked).

Last leak-fix shows that someone clearly thinks StringWriterClose() is
a good way to close a StringWriter - perhaps not the best choice of
function name, given that this is wrong ! - when actually it's a way
to extract its final value (while closing it).  Therefore callers must
in fact do something with that value - if they ignore the return, they
definitely don't free() it like they should !

I tried doing similar for FileWriterDetach() - but FileWriter(stdout)
and even FileWriter(fd) are commonly used, by callers who have no
business closing stdout or fd; FileWriterDetach() is then the sensible
and proper way to let go after using the Writer.
Leak-fix: PromiseIteratorDestroy() neglected the primary allocation.

It tidies away the parts, but forgot to tidy away the container !
Leak-fix: parser objects were getting leaked.

The parser appears to be quite careful about moving off the fragments
it parses into structures, clearing each fragment once it's found a
home; but valgrind reports some leaks, which I conjecture arise when
the paser barfs on bad input and doesn't tidy away all of the
fragments it had in the air when it hit that.  Sigurd confirms that
this is plausible.  The approach here is a bit defensive: it deletes
anything it finds in the currentfnid, giveargs and currentfncall
stacks when we fail, clearing the entries to NULL as it goes; and
asserts they are NULL when we succeed.

Clear currentfncall entry after deleting it (prevents the foregoing
from turning into a double-free) or handing it off to P.rval (which
now owns it, so the foregoing needs to not delete it).
Simplifications in verify_classes.c

Some convoluted decision-making code could be replaced by simple use
of (non-trivial) boolean expressions.  Made a few variables more local
than they were.  Commented on a Log() where ProgrammingError() might
be more apt.
Message is now more human-oriented.
Correctly increase reference count of OpenSSL structs...

when they are being referenced multiple times, and free each used
structure after use. Now this test passes valgrind with no leaks or
double-free(). Lesson to be learned: do not mock OpenSSL. ;-) Also added
some error messages.
indentation
Properly use OpenSSL API, properly free structs.
Remove X509_verify call from TLSVerifyPeer...

since it's not needed for self-signed certificates. All we have to do
(and we already do) is compare the RSA key we got during handshake with
the one we expect. Verifying signature is expensive and not needed,
since TLS handshake includes at least one RSA decrypt or sign operation.
Abstract the creation of in-memory dummy certificate into
tls_generic.c. Handle errors more carefully.
tls_generic_test is currently leaking memory.

All the new struct opaqueness together with SSL mocking, is giving me a
hard time to fix the leaks, so just mark the relevant lines with TODO.
Removed garbage comments.
Fix avahi_config_test.
Merge remote-tracking branch 'eddy/leak-hunt'
Fail function getindices on unqualified reference with non-promise caller