fix fd leak in tmpfile when the fdopen operation fails
authorRich Felker <dalias@aerifal.cx>
Fri, 6 Jun 2014 07:17:47 +0000 (03:17 -0400)
committerRich Felker <dalias@aerifal.cx>
Fri, 6 Jun 2014 07:17:47 +0000 (03:17 -0400)
commit60158bff74e478a8031f618ea5e0546bf41a3523
tree87bcb18c9d4efa3410579d9467b40047f7a91ca3
parent2abb70c302efe46dfd8fd9e1d64fa00f1376f428
fix fd leak in tmpfile when the fdopen operation fails

this condition could only happen due to malloc failure.

the fdopen operation is also moved to take place after the unlink to
minimize the window during which a link to the file exists in the
directory table.
src/stdio/tmpfile.c