I'm curious about the #ifdef guard, which is of a form I've never encountered.
#ifndef BD9DF82A4540BB19368E48E4747C0706
#define BD9DF82A4540BB19368E48E4747C0706
Does some IDE do that for you? Did you just pick a random sequence? Why not just a variant of #ifndef _salmagundi_h that is more common?Other than that, I strongly echo other's advice about avoiding so many mallocs.
What's wrong with `#pragma once`? (honest question, i only do C and C++ as a hobby)
It's the length of an MD5 hash, which I'd wager isn't a coincidence. It's not "salmagundi", "Salmagundi", or "salmagundi.h" though.
Amazing how hard some people try to avoid the obviously correct and portable "#pragma once".