What I'm trying to get at is we've been leaking memory all this time.
Everything is manually done including resource management. Typically in C, when a function returns a pointer, it usually means there was something dynamically allocated and the pointer to it was returned back to you. This means it heavily relies on pointers and passing pointers around.
Before we start this next part, we need to have a little talk about resource management in SDL2.