LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-29-2006, 08:40 PM   #1
dayalan_cse
Member
 
Registered: Oct 2006
Posts: 122

Rep: Reputation: 15
glibc detected double free or corruption (URGENT)


hello,

i am getting *** glibc detected *** double free or corruption (!prev): 0x080bd7c0 *** this error can anyone help me to resolve this error. this type of error will occur due to malloc or calloc functions but still not have good idea to resolve this glibc double free error.

quest:
1. what is this error.
2. how to solve this error.
3. how to set MALLOC_CHECK_ variable

Thanks & Regards
dayalan
 
Old 10-29-2006, 09:06 PM   #2
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,014

Rep: Reputation: 115Reputation: 115
a. it isn't urgent for me
b. can't help you much without the code
c. looks like you need a copy of K&R The C programming language

As the error message states, you are calling free() on a pointer more than once. Without code, all I can say is try and inspect everywhere you call malloc() and free() for the potential of multiple free() calls.
 
Old 10-29-2006, 09:46 PM   #3
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Always initialize pointers to NULL and always set free pointers to NULL

Tuxdev is right.

But the first, best thing you can do is:

1. Look at your code.
a) Find everyplace you declare a pointer, and initialize it to NULL at the exact point you declare it.
b) Find everyplace you free the pointer, and set it to NULL the moment after you free it.
<= This won't only help you find this particular problem...
it's also a great habit to get into

2. See if there's any place where you might inadvertantly call "free" on a variable that's already free.

Good luck .. PSM
 
Old 10-30-2006, 11:06 AM   #4
soggycornflake
Member
 
Registered: May 2006
Location: England
Distribution: Slackware 10.2, Slamd64
Posts: 249

Rep: Reputation: 31
Sounds like you need to visit http://www.valgrind.org/ (after you've read K&R, of course! ).
 
Old 10-30-2006, 03:23 PM   #5
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
you could even to something really crazy like use a debugger to walk through the code and find where it is crashing..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FC3 glibc detected *** double free or corruption: josedragone Fedora 5 09-17-2009 10:16 PM
*** glibc detected *** double free or corruption (!prev): 0x082c1120 *** eXor Slackware 6 04-11-2008 08:47 AM
*** glibc detected *** double free or corruption (!prev): 0x08294448 *** Deepti Joshi Linux - Software 1 05-31-2006 10:55 PM
*** glibc detected *** double free or corruption (C++) urzumph Programming 25 01-07-2006 04:03 PM
Open Office user install error: *** glibc detected *** double free or corruption: 0xb r_jensen11 Linux - General 6 01-16-2005 06:08 AM


All times are GMT -5. The time now is 02:42 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration