mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-17 08:48:58 +00:00
cdp: fix memory leak in msg parsing of the JSON
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
@@ -23,6 +23,7 @@ const Ctx = server.Ctx;
|
||||
const cdp = @import("cdp.zig");
|
||||
const result = cdp.result;
|
||||
const IncomingMessage = @import("msg.zig").IncomingMessage;
|
||||
const Input = @import("msg.zig").Input;
|
||||
|
||||
const log = std.log.scoped(.cdp);
|
||||
|
||||
@@ -52,7 +53,8 @@ fn enable(
|
||||
_: *Ctx,
|
||||
) ![]const u8 {
|
||||
// input
|
||||
const input = try msg.getInput(alloc, void);
|
||||
const input = try Input(void).get(alloc, msg);
|
||||
defer input.deinit();
|
||||
log.debug("Req > id {d}, method {s}", .{ input.id, "network.enable" });
|
||||
|
||||
return result(alloc, input.id, null, null, input.sessionId);
|
||||
@@ -65,7 +67,8 @@ fn setCacheDisabled(
|
||||
_: *Ctx,
|
||||
) ![]const u8 {
|
||||
// input
|
||||
const input = try msg.getInput(alloc, void);
|
||||
const input = try Input(void).get(alloc, msg);
|
||||
defer input.deinit();
|
||||
log.debug("Req > id {d}, method {s}", .{ input.id, "network.setCacheDisabled" });
|
||||
|
||||
return result(alloc, input.id, null, null, input.sessionId);
|
||||
|
||||
Reference in New Issue
Block a user