In article <[EMAIL PROTECTED]>,
Jason Gunthorpe <[EMAIL PROTECTED]> wrote:
>>         fclose(fp);
>>         fclose(fp);
>
>This is not valid. fclose's behavoir on a null fp is apparently not
>defined, but exiting with error would be prefered to faulting.

It isn't a NULL fp. It's a fp that just points to a random FILE *
in freed up memory.

>A double
>fclose is just as bad as a double free() and is not a library error should
>it fault or corrupt memory.

Indeed. If you open another file, it might happen that the struct FILE
is allocated at the same place as the previous one. And if you then
fclose(old_fp) you're really in trouble.

Mike.
-- 
 Miquel van Smoorenburg | Our vision is to speed up time,
    [EMAIL PROTECTED]  |   eventually eliminating it.


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to