runtime: fix small leak in Blob deinit (#24802)

pulled out of https://github.com/oven-sh/bun/pull/21663
This commit is contained in:
Meghan Denny
2025-11-18 06:55:15 -08:00
committed by GitHub
parent 7c485177ee
commit af498a0483
2 changed files with 2 additions and 1 deletions

View File

@@ -494,7 +494,7 @@ async function runTests() {
if (isBuildkite) {
// Group flaky tests together, regardless of the title
const context = flaky ? "flaky" : title;
const style = flaky || title.startsWith("vendor") ? "warning" : "error";
const style = flaky ? "warning" : "error";
if (!flaky) attempt = 1; // no need to show the retries count on failures, we know it maxed out
if (title.startsWith("vendor")) {

View File

@@ -4772,6 +4772,7 @@ export fn Blob__ref(self: *Blob) void {
export fn Blob__deref(self: *Blob) void {
bun.assertf(self.isHeapAllocated(), "cannot deref: this Blob is not heap-allocated", .{});
if (self.#ref_count.decrement() == .should_destroy) {
self.#ref_count.increment(); // deinit has its own isHeapAllocated() guard around bun.destroy(this), so this is needed to ensure that returns true.
self.deinit();
}
}