Cleaned up a lot of stuff in shared buffer stuff.
Fixed a g_malloc mug.