0

I'm currently working on Minix. I'm creating a game "Arkanoid" and so far it's been working fine. I've already added the keyboard and timer functionalities but now when I add the mouse my program just crashes.

I checked my log files and I'm getting this message:

Dec 15 16:16:30 172 kernel: Arkanoi(109705): panic: 
Dec 15 16:16:30 172 kernel: Assertion "(char *) NextSlot(p) <= next" failed, file "/usr/src/lib/libc/ansi/malloc.c", line 245
Dec 15 16:16:30 172 kernel: 
Dec 15 16:16:30 172 kernel: syslib:panic.c: stacktrace: 
Dec 15 16:16:30 172 kernel: 0x55c3 
Dec 15 16:16:30 172 kernel: 0x652c 
Dec 15 16:16:30 172 kernel: 0xb060 
Dec 15 16:16:30 172 kernel: 0x2cda 
Dec 15 16:16:30 172 kernel: 0x3b0f 
Dec 15 16:16:30 172 kernel: 0x20b3 
Dec 15 16:16:30 172 kernel: 0x100a 

I'm not sure what that is referring to.

Here are the following codes in use:

Mouse.c: http://pastebin.com/k4KYyWLD

Arkanoid.c: http://pastebin.com/C7HiBa8u

Thanks for the help. I really don't know what's causing this.

Oneah
  • 11
  • 1
  • 1
    you forgot a `return mouse;` in `newMouse()`. The last 3 commands in `mouse_unsubscribe_int()` are unreachable code. – mch Dec 15 '14 at 16:04
  • thanks! I've fixed the newMouse() not returning mouse and I removed the 1st line of return 0 on the mouse_unsubscribe_int(). Program is still crashing right after running though. – Oneah Dec 15 '14 at 16:22
  • 1
    I've checked the logs, it no longer is giving the same error. I've placed some printf orders to know where the program is reaching and for some reason it's not going further than this: Dec 15 17:20:28 172 kernel: Aqui drawcross2 – Oneah Dec 15 '14 at 16:25
  • 1
    Normally, segfaulting in `malloc` means you've accidentally done an out of bounds access and overwritten some of `malloc`'s internal stuff. Check around and ensure you're not doing this. Also, I assume you're on Minix, but can you run under Valgrind? – slugonamission Dec 15 '14 at 18:36

0 Answers0