free()



Hi group,

I have a question to ask you all. I have allocated some chunk of
memory using ptr=(int*)malloc(). now I am trying to free that memory
using free((void*)ptr). My question is does free() make ptr NULL? If
not how do we know whether ptr memory has been freed already and we
should not try to free the same memory twice. Man pages does not tell
anything about this behavoiur.

Thanks,

.



Relevant Pages

  • Re: free()
    ... now I am trying to free that memory ... not how do we know whether ptr memory has been freed already and we ... freemarks the allocated memory chunk to 'not in use' ... write the memory space which not belongs to you, ...
    (comp.lang.c)
  • Re: free()
    ... I have allocated some chunk of ... Drop the pointless obfuscatory cast. ... not how do we know whether ptr memory has been freed already ...
    (comp.lang.c)
  • Re: free()
    ... not how do we know whether ptr memory has been freed already ... P=0x8049800: raxit sheth ...
    (comp.lang.c)
  • Re: [Vuln-Dev Challenge] - VulnDev1.c Summary
    ... meaning the chunk is allocated with mmap. ... turn calls munmap on an invalid memory address. ... > the Doug Lea algorithm as well has heap-based exploitation methods ... > the forward chunk, in our case buf2, is free. ...
    (Vuln-Dev)
  • The Malloc Maleficarum
    ... Glibc Malloc Exploitation Techniques ... the exploitation of overflowed dynamic memory chunks on Linux. ... I have the House of Prime. ... a malloc chunk. ...
    (Bugtraq)