[MINC-development] Another pass at micreate_tempfile()

Peter NEELIN minc-development@bic.mni.mcgill.ca
Thu, 13 Mar 2003 21:45:45 -0500


On Thu, 13 Mar 2003, Robert VINCENT wrote:

> After a brief hiatus, here is a revised take on the micreate_tempfile()
> function for your comments...
>
> The new version of the function returns a malloc'd string, or NULL on
> error.  It takes no arguments.

'Looks good. Minor point though - if malloc returns NULL, I think that you
will try to free the NULL anyway (farther down, outside the #if, when you
test the file descriptor). Rather than setting temp_fd to -1, it would be
simpler to just return NULL immediately. There is no cleanup required at
that point (memory or descriptors).

            Peter
----
            Peter Neelin (neelin@bic.mni.mcgill.ca)