Make tls1_get_formatlist() behave the same as tls1_get_curvelist() and
return the client format list if the client_formats flag is specified.
Use tls1_get_formatlist()/tls1_get_curvelist() in tls1_check_ec_key(),
simplifying the code.

ok miod@
Use tls1_get_curvelist() in ssl_add_clienthello_tlsext(), rather than
hand rolling the same code.

ok miod@
Use more specific curves/formats naming for local variables in
ssl_add_clienthello_tlsext() and ssl_add_serverhello_tlsext(), rather than
the current generic naming.

ok miod@
compile with c89 (code / decl ordering); from Joakim.Tjernlund@transmode.se
ok miod
Fix memory leak in the error path of v2i_AUTHORITY_KEYID().
ok deraadt@ guenther@
Missing deallocation upon error.
ok deraadt@ guenther@
Be sure to check object allocation for success before using them.
Tweaks and ok guenther@
Memory leak upon error in set_dist_point_name().
ok guenther@
In v2i_AUTHORITY_INFO_ACCESS(), separate object allocation from object push
on a stack; if the latter fails, we need to free the object before returning
failure.
ok guenther@
Be sure to check the stack push operation for success in v2i_POLICY_MAPPINGS();
if it fails, free the object we were about to push.
Factor error handling to avoid having four copies of about the same code.
ok guenther@
The fixes to X509_PURPOSE_add() in r1.18 actually could cause a global
X509_PURPOSE object (obtained with X509_PURPOSE_get0() instead of being
allocated in the function) to be freed if modifying that object would fail
due to a low memory condition, while this object would still be referenced
elsewhere.
Fix this by only cleaning the object if we did not allocate it here.

While there, fail early if either `name' or `sname' are NULL, rather than
allocating an object and realizing we have nothing to strdup() into it.

ok guenther@