Answering my own question:
So, after some trial and error and with the help of community, I got it resolved. It's a problem with specifying path in CSF file. Earlier, I used tilde to specify the home and that has created a lot of chaos.
Here's a note to all:
Don't use tilde(~) in CSF it's causing the 'realloc(): invalid pointer' error. Either use full path (/home/$(whoami)) or relative path (../../)