diff options
author | Marvin Borner | 2021-02-14 17:07:29 +0100 |
---|---|---|
committer | Marvin Borner | 2021-02-14 17:07:29 +0100 |
commit | 1287f9dfe987f0456e4fb0741385d5f0278ef53b (patch) | |
tree | 64d3da484a4d186a725779f20d339432d51f441a /kernel/drivers/keyboard.c | |
parent | bc4e62f629a392e1a4cf204665e91c57f4e619b2 (diff) |
Message waiting and more!
Diffstat (limited to 'kernel/drivers/keyboard.c')
-rw-r--r-- | kernel/drivers/keyboard.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/drivers/keyboard.c b/kernel/drivers/keyboard.c index 1652625..f22af80 100644 --- a/kernel/drivers/keyboard.c +++ b/kernel/drivers/keyboard.c @@ -33,8 +33,6 @@ void keyboard_handler() // TODO: "Merge" scancode to linux keycode? /* printf("%x %x = %x\n", scancode, state ? 0xe0 : 0, merged); */ - if (event) - free(event); event = malloc(sizeof(*event)); event->magic = KEYBOARD_MAGIC; event->press = (scancode & 0x80) == 0; @@ -68,6 +66,7 @@ s32 keyboard_read(void *buf, u32 offset, u32 count, struct device *dev) struct event *e = stack_pop(queue); memcpy(buf, (u8 *)e + offset, count); + free(e); return count; } @@ -87,7 +86,7 @@ void keyboard_install(void) irq_install_handler(1, keyboard_handler); queue = stack_new(); - struct device *dev = malloc(sizeof(*dev)); + struct device *dev = zalloc(sizeof(*dev)); dev->name = strdup("kbd"); dev->type = DEV_CHAR; dev->read = keyboard_read; |