summaryrefslogtreecommitdiff
path: root/src/support
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-08-29 08:23:48 -0700
committerGitHub <noreply@github.com>2022-08-29 08:23:48 -0700
commit408a15ba4e76879a512ebaf80d93d44145a7a27f (patch)
tree5e9a934de373b5ce82cba63012de0a92277243e6 /src/support
parent7fb44812fa307a5924e5ada58b4015de6736cce3 (diff)
downloadbinaryen-408a15ba4e76879a512ebaf80d93d44145a7a27f.tar.gz
binaryen-408a15ba4e76879a512ebaf80d93d44145a7a27f.tar.bz2
binaryen-408a15ba4e76879a512ebaf80d93d44145a7a27f.zip
Fix SmallVector's resize() method (#4979)
A resize from a large amount to a small amount would sometimes not clear the flexible storage, if we used it before but not after.
Diffstat (limited to 'src/support')
-rw-r--r--src/support/small_vector.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/support/small_vector.h b/src/support/small_vector.h
index e2c865b8f..7c03ae02b 100644
--- a/src/support/small_vector.h
+++ b/src/support/small_vector.h
@@ -116,6 +116,8 @@ public:
usedFixed = std::min(N, newSize);
if (newSize > N) {
flexible.resize(newSize - N);
+ } else {
+ flexible.clear();
}
}