Use glib for all allocations

- Removes need to check for malloc failure
- Removes need for NULL checks on free
- Adds checks for integer overflows
- Removes some extra memset calls
- Removes chance of mixing libc and glib malloc/free
Use glib for allocations in all plugins

Continuation of 83032b1aa
Fix building as c89