Interpret failing function calls in ifvarclass/if/unless as class not set.

ifvarclass is treated explicitly during the evaluation of a promise.
Function calls might fail due to unexpanded variables in arguments or
for other reasons, in which case the classes should be assumed not to
be set, ie ifvarclass should block the promise.

Include acceptance test.

Fixes Redmine 6327 for 3.6.x.
(cherry picked from commit a07d3b2362de3de1c5f8a43d29c3bcea87b96a3f)

Conflicts:

	libpromises/eval_context.c
	libpromises/promises.c
Improve test case for ifvarclass with functions

As per feedback to ediosyncratic, make sure we test the positive
case as well, and use standard "ok" class to mark pass/fail.
(cherry picked from commit dcedd29b2aa3cda93264cc7497611526a263e8c7)
Merge pull request #1925 from vohi/redmine/6327-36x

Redmine 6327 - Interpret failing function calls in ifvarclass as class not set
Merge remote-tracking branch 'upstream/3.6.x' into 3.6.x
Fix blatant memory trample.

(cherry picked from commit f242cb65ac9f84f6a939371b88f62d092c50a972)
Fix for uninitialized pointer free in SocketConnect().

As pointed out by @worr in #1918, failure of getaddrinfo() may leave
response2 unset, in which case calling freeaddrinfo() on it is apt to
crash.  None the less, nothing guarantees that failing getaddrinfo()
won't set the response list (e.g. when OOM prevents it allocating
space for further entries).  So initialise it to NULL.

Also move the declaration closer to its use.

(cherry picked from commit 87449edc027d0cc9f408c157e3b038c4dd96a627)
Protect against freeaddrinfo(NULL);

Apparently some implementations don't handle this gracefully.
/me bangs head on wall, but is glad I googled.

(cherry picked from commit a79088afbc0f065eb06a6c3116d8272f4a74207c)
Fix another addrinfo corner case in SocketConnect().

The initial call to getaddrinfo() is subject to the same concerns as
the secondary one, as noticed by @jimis in code review.

(cherry picked from commit c7810dd05782aeee46d930cbf7ee4b94cf6d7f7c)
Merge remote-tracking branch 'upstream/3.6.x' into 3.6.x