fix(kqueue): another leak on handler error

This commit is contained in:
CJ van den Berg 2026-03-14 19:09:50 +01:00
parent 9d58c9b701
commit 5191340c0b
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -232,13 +232,10 @@ fn scan_dir(self: *@This(), allocator: std.mem.Allocator, dir_path: []const u8)
for (new_dirs.items) |full_path|
try self.handler.change(full_path, EventType.created, .dir);
for (to_delete.items) |name| {
defer allocator.free(name); // snapshot key, owned by allocator
var path_buf: [std.fs.max_path_bytes]u8 = undefined;
const full_path = std.fmt.bufPrint(&path_buf, "{s}/{s}", .{ dir_path, name }) catch {
allocator.free(name);
continue;
};
const full_path = std.fmt.bufPrint(&path_buf, "{s}/{s}", .{ dir_path, name }) catch continue;
try self.handler.change(full_path, EventType.deleted, .file);
allocator.free(name); // snapshot key, owned by allocator
}
for (to_create.items) |name| {
var path_buf: [std.fs.max_path_bytes]u8 = undefined;