This a short snippet of code, with two calls to exit(3)
in case of failure.
Do these calls deallocate memory allocated by malloc? Google search once says it does, a
Just a note that at those 2 calls to exit you have - you have failed to allocate any memory, so freeing that pointer is going to be pretty pointless (and might crash, depending on how old your C runtime system is).
So, no, you shouldn't free it, because it doesn't exist.
I'd have said in the case of a fatal error like that, you probably don't want to bother freeing up memory.
However, if your program exits normally, yes, you should try and free up all the memory you have allocated. That can be quite tricky sometimes.