So I am working with a "standard" library with more than a decade of history for brain image I/O. I encountered this function:
nifti_image* nifti_image_read( const char *hname , int read_data ){
nifti_image* nim;
...
<<<some IO operations>>>
...
return nim;
}
My question is, how come this function is returning a local pointer to an automatic variable? Isn't this practice prohibited since the nim pointer goes out of scope and is supposed to be deleted after completion of the function?
I have already read this question but couldn't get my answer: