fix memory leak in ERR_INVALID_ARG_TYPE (#17169)

This commit is contained in:
Meghan Denny
2025-02-10 18:50:49 -08:00
committed by GitHub
parent c2edbe848f
commit 7adb2b9502
12 changed files with 100 additions and 26 deletions

View File

@@ -202,8 +202,8 @@ JSObject* createError(Zig::JSGlobalObject* globalObject, ErrorCode code, JSC::JS
return createError(vm, globalObject, code, message, isDOMExceptionPrototype);
}
// export fn Bun__inspect(globalThis: *JSGlobalObject, value: JSValue) ZigString
extern "C" ZigString Bun__inspect(JSC::JSGlobalObject* globalObject, JSValue value);
// export fn Bun__inspect(globalThis: *JSGlobalObject, value: JSValue) bun.String
extern "C" BunString Bun__inspect(JSC::JSGlobalObject* globalObject, JSValue value);
//
WTF::String JSValueToStringSafe(JSC::JSGlobalObject* globalObject, JSValue arg)
@@ -247,9 +247,7 @@ WTF::String JSValueToStringSafe(JSC::JSGlobalObject* globalObject, JSValue arg)
}
}
ZigString zstring = Bun__inspect(globalObject, arg);
BunString bstring(BunStringTag::ZigString, BunStringImpl(zstring));
return bstring.toWTFString();
return Bun__inspect(globalObject, arg).transferToWTFString();
}
WTF::String determineSpecificType(JSC::JSGlobalObject* globalObject, JSValue value)