SleepWakeInterest not working as intended

Hey there!

First of all, here is a link to the complete project to provide as much clarity as possible: click.

Disclaimer: I'm a total kernel-noob, my whole C experience stems from AVR embedded hobbyist-work.

I'm trying to fire callbacks for sleep, wake from sleep, system power up and system shut down (including for a restart).

Wake and wake from sleep are firing as intended and logging to the file (crude, I know...). Everything else is not being called within the switch statement.

Also: when restarting, I'm getting a new .shutdownStall in my /Library/Logs/DiagnosticReports. This looks like I'm screwing up with deallocating resources somewhere, but I just can't seem to find it, since I'm not yet comfortable enough with the whole environment. Is anybody able to spot the mistake?

Thanks a lot for any help, I appreciate it big time! And sorry for my ignorance regarding the topic, I'm really new to all of this.