Skip to content

Commit

Permalink
Fix memory leak in base64url (#4111)
Browse files Browse the repository at this point in the history
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
  • Loading branch information
Jarred-Sumner and Jarred-Sumner committed Aug 11, 2023
1 parent 66da021 commit c314346
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bun.js/webcore/encoding.zig
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,8 @@ pub const Encoder = struct {
.base64url => {
var out = bun.String.createUninitialized(.latin1, bun.base64.urlSafeEncodeLen(input)) orelse return ZigString.init("Out of memory").toErrorInstance(global);
defer out.deref();
const outlen = bun.base64.encodeURLSafe(@constCast(out.latin1()), input);
return out.toJSWithLength(global, outlen);
_ = bun.base64.encodeURLSafe(@constCast(out.latin1()), input);
return out.toJS(global);
},

.base64 => {
Expand Down

0 comments on commit c314346

Please sign in to comment.