Call va_end even if OPENSSL_vasprintf_internal fails Though malloc failures are practically impossible and I believe va_end is a no-op on all platforms we support, it is technically UB to call va_start without calling va_end. Fix that. Change-Id: I326f7d3c5c7dab3e6200c4ce2c483c1dd91778ae Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/102707 Auto-Submit: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com> Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Adam Langley <agl@google.com>
diff --git a/crypto/err/err.cc b/crypto/err/err.cc index 997399e..fc30f01 100644 --- a/crypto/err/err.cc +++ b/crypto/err/err.cc
@@ -670,10 +670,11 @@ va_list ap; va_start(ap, format); - if (OPENSSL_vasprintf_internal(&buf, format, ap, /*system_malloc=*/1) == -1) { + int len = OPENSSL_vasprintf_internal(&buf, format, ap, /*system_malloc=*/1); + va_end(ap); + if (len == -1) { return; } - va_end(ap); err_set_error_data(buf); }