bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nasty consequence of fclose followed by ferror


From: Garance A Drosihn
Subject: Re: Nasty consequence of fclose followed by ferror
Date: Mon, 27 Nov 2000 12:09:07 -0500

At 9:07 AM +0100 11/23/00, Andreas Jaeger wrote:
 >>>>> Garance A Drosihn writes:
 > However, for the sanity of other people who might run into
 > this problem, I was wondering if there was some simple and
 > inexpensive change which could be made to fclose or ferror
 > which would make debugging this much less painful.

No such change is possible - it would lead to memory leaks.

I do not understand how this would lead to memory leaks.

I did not expect anyone to malloc any new memory, or to
not-free any memory which is currently freed.  I was just
thinking one could stuff obviously-invalid values into
whatever pointer field is being used for the lock, as
the memory pointed to by those pointers are freed.

That memory (with obviously-invalid values) might still
be freed right after the fields were zapped, but it still
might help for the case where ferror is called IMMEDIATELY
after fclose.  I realize that the more work which was done
between those two calls (fclose and ferror), the less
likely such a change would do any good.

It would probably be best for me to leave this topic until
I have time to look at the code and come up with a more
specific suggestion.  I can believe that there is no good
fix, but I just wanted to make it clear that I was not
thinking of any solution which would introduce a memory
leak.
--
Garance Alistair Drosehn            =   address@hidden
Senior Systems Programmer           or  address@hidden
Rensselaer Polytechnic Institute    or  address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]