SDL2 does not initialize at all and throws a SIGSEGV stopping in SDL_DestroyRenderer

SDL2 is a completely fantastic library and i’m still learning the
intricacies of programming.
I’m writing a snake game since quite some time.Note that before the
forthcoming problem came up SDL initialised the video library
successfully and rendered the game properly, only catch was when I
exited it threw a SIGSEGV at the destroy functions.
I had written an init function almost same as the one given in
lazyfoos tutorial that init the Renderer and Window.However, after
investigating the issue in gdb, it never initialises. SDL_init is
called but it never returns and throws SIGSEGV .

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b227cd in SDL_DestroyRenderer_REAL (renderer=0x7) at
1841 CHECK_RENDERER_MAGIC(renderer, );
I don’t understand how did it jump to the SDL_DestroyRenderer function
straight from SDL_init.
Checked the macro and found out this usage it is deliberate. So it’s
not a bug. right?
I apologise for such a writeup, this problem has irking me for long.
Do I have to compile SDL from scratch as i did ?
Please do tell me if there’s any more info required.