On Sat, Feb 26, 2011 at 2:51 PM, Michael Santos wrote: > check_error() returns false if the fd is bad (-1), so the fd shouldn't > need to be closed since no resources have been allocated. Maybe the file > leak is happening somewhere else? Thanks Michael. You are right. There is no leak.