From 662bfad81002086c217a9042ed459efd5e0bf82c Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Tue, 15 Sep 2020 15:22:01 -0400 Subject: [PATCH] Fix potential leak in bssl::Array::Shrink. We don't currently use this type anywhere with a nontrivial destructor, so this doesn't matter right now. But handle this correctly in case we ever do. (One of these days, we should sort out using the STL and Abseil in here...) Change-Id: I6a198ccf87f953cedcdbe658fa508a3b79d47305 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/42825 Commit-Queue: Adam Langley Reviewed-by: Adam Langley --- ssl/internal.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ssl/internal.h b/ssl/internal.h index e08505fc79..750bfe93af 100644 --- a/ssl/internal.h +++ b/ssl/internal.h @@ -345,6 +345,9 @@ class Array { if (new_size > size_) { abort(); } + for (size_t i = new_size; i < size_; i++) { + data_[i].~T(); + } size_ = new_size; }