BLE Custom Profile : Hardfault after advertising

I am trying to implement a simple example with custom profile by building upon the tutorial given

My profile is something like this: Service 1 -->Characteristic 1 Service 2 -->Characteristic 1 -->Characteristic 2

I am using the FreeRTOS HRM example as the base because we need FreeRTOS in our project. Logger is enabled to print all the debug/info data.

I am attaching the main.c file which I am using for this.

The problem is that BLE starts to advertise but then encounters a hardfault which triggers a reset. I have got the additional log printed related to Cortex m4 registers.

Although, I am not able to trace what exactly is triggering this hardfault?

I have tried this example with gcc 2016 q2 and gcc 2017 q1 compilers and the result remains the same.

File(main.c and image of log) are here :