The point is that you can so everywhere and eliminate the temporaries.
Just as you assign like &something, just type that &something instead of the temporary variable when passing arguments.
I can only see you using an unitialized pointer. So how you got those results at all is beyond me.Can anyone see which pointer is leading my program astray?
You are also allocating memory with malloc without freeing it with free.
And your code is horribly indented, it's difficult to read.