Re: double free
From: jacob navia (jacob_at_jacob.remcomp.fr)
Date: 07/01/04
- Next message: Stephen Sprunk: "Re: Long term nuclear waste disposal"
- Previous message: Programmer Dude: "Re: Long term nuclear waste disposal"
- In reply to: weaselboy1976: "double free"
- Next in thread: Alan Balmer: "Re: double free"
- Reply: Alan Balmer: "Re: double free"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 1 Jul 2004 21:50:57 +0200
"weaselboy1976" <weaselboy1976@yahoo.com> a écrit dans le message de
news:c76c305f.0407011027.5749e6d2@posting.google.com...
> Hello
>
> Does anyone know of a good website that actually describes and
> demonstrates WHY freeing a pointer more than once is a problem. I'm
> specifically interested in what the ill effects are.
>
> Also, if you know of any really good books that describe everything
> about memory in a c program ...
>
> Thanks in advance!
I assume that in all implementations where
free checks if the address is *already* in the free list
nothing serious can happen.
In all others, there is a block twice in the free list,
that can later be allocated twice to the program
again. Unrelated data items will have the same
address and when you write into one you corrupt the
other.
This can go unnoticed for years or provoke
a crash immediately. It depends on which blocks
are used where, etc.
Depending on the algorithm used by free, the
free list could become corrupted when inserting
a block that is already there.
To avoid this, and other catastrophes that may fall into you
use a garbage collector. The machine takes care of
freeing blocks regularly.
lcc-win32 offers a gc with its runtime.
- Next message: Stephen Sprunk: "Re: Long term nuclear waste disposal"
- Previous message: Programmer Dude: "Re: Long term nuclear waste disposal"
- In reply to: weaselboy1976: "double free"
- Next in thread: Alan Balmer: "Re: double free"
- Reply: Alan Balmer: "Re: double free"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|