LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 01-24-2008, 03:53 PM   #1
lamtab
Member
 
Registered: Nov 2007
Posts: 31

Rep: Reputation: 15
glibc double free or corruption


I'm getting this message and i can't see why.my program creates threads.
valgrind output is this:

==28643== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 37 from 2)
==28643== malloc/free: in use at exit: 13,266 bytes in 32 blocks.
==28643== malloc/free: 1,524 allocs, 1,492 frees, 89,027 bytes allocated.
==28643== For counts of detected errors, rerun with: -v
==28643== searching for pointers to 32 not-freed blocks.
==28643== checked 162,412 bytes.
==28643==
==28643== 24 bytes in 1 blocks are still reachable in loss record 1 of 6
==28643== at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==28643== by 0x4022BFC: realloc (vg_replace_malloc.c:429)
==28643== by 0x80532DD: (within /bin/ls)
==28643== by 0x804C354: (within /bin/ls)
==28643== by 0x804D25A: (within /bin/ls)
==28643== by 0x804E8C7: (within /bin/ls)
==28643== by 0x407904F: (below main) (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643==
==28643==
==28643== 118 bytes in 7 blocks are still reachable in loss record 2 of 6
==28643== at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==28643== by 0x8053201: (within /bin/ls)
==28643== by 0x8052536: (within /bin/ls)
==28643== by 0x804E522: (within /bin/ls)
==28643== by 0x407904F: (below main) (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643==
==28643==
==28643== 312 (72 direct, 240 indirect) bytes in 2 blocks are definitely lost in loss record 3 of 6
==28643== at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==28643== by 0x41479B2: (within /lib/tls/i686/cmov/libc-2.6.1.so)
==28643== by 0x4148208: __nss_database_lookup (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643== by 0x4745FDB: ???
==28643== by 0x474711C: ???
==28643== by 0x40F4EEB: getpwuid_r (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643== by 0x40F489D: getpwuid (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643== by 0x80522C4: (within /bin/ls)
==28643== by 0x804AAFB: (within /bin/ls)
==28643== by 0x804BB2C: (within /bin/ls)
==28643== by 0x804E7F9: (within /bin/ls)
==28643== by 0x407904F: (below main) (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643==
==28643==
==28643== 80 bytes in 10 blocks are indirectly lost in loss record 4 of 6
==28643== at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==28643== by 0x414758B: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643== by 0x4745FFB: ???
==28643== by 0x474711C: ???
==28643== by 0x40F4EEB: getpwuid_r (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643== by 0x40F489D: getpwuid (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643== by 0x80522C4: (within /bin/ls)
==28643== by 0x804AAFB: (within /bin/ls)
==28643== by 0x804BB2C: (within /bin/ls)
==28643== by 0x804E7F9: (within /bin/ls)
==28643== by 0x407904F: (below main) (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643==
==28643==
==28643== 160 bytes in 10 blocks are indirectly lost in loss record 5 of 6
==28643== at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==28643== by 0x4134D0B: tsearch (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643== by 0x414754D: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643== by 0x4745FFB: ???
==28643== by 0x474711C: ???
==28643== by 0x40F4EEB: getpwuid_r (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643== by 0x40F489D: getpwuid (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643== by 0x80522C4: (within /bin/ls)
==28643== by 0x804AAFB: (within /bin/ls)
==28643== by 0x804BB2C: (within /bin/ls)
==28643== by 0x804E7F9: (within /bin/ls)
==28643== by 0x407904F: (below main) (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643==
==28643==
==28643== 12,812 bytes in 2 blocks are still reachable in loss record 6 of 6
==28643== at 0x4022AB8: malloc (vg_replace_malloc.c:207)
==28643== by 0x8053326: (within /bin/ls)
==28643== by 0x804E7A0: (within /bin/ls)
==28643== by 0x407904F: (below main) (in /lib/tls/i686/cmov/libc-2.6.1.so)
==28643==
==28643== LEAK SUMMARY:
==28643== definitely lost: 72 bytes in 2 blocks.
==28643== indirectly lost: 240 bytes in 20 blocks.
==28643== possibly lost: 0 bytes in 0 blocks.
==28643== still reachable: 12,954 bytes in 10 blocks.
==28643== suppressed: 0 bytes in 0 blocks.
 
Old 01-24-2008, 04:40 PM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,300
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by lamtab View Post
I'm getting this message and i can't see why. my program creates threads.
We can't see why either. If you provide a snippet of code, it may help. Are you doing something like this in your code?
Code:
    system("/bin/ls");
 
Old 01-25-2008, 03:21 AM   #3
lamtab
Member
 
Registered: Nov 2007
Posts: 31

Original Poster
Rep: Reputation: 15
Code:
    system("/bin/ls");
No nothing like that. The double free error was for this:

templist = *ptraddr;
*ptraddr = (*ptraddr)->next;
free(templist);

but now it's solved. Now i get a malloc corruption(fast) for this:

while (*ptraddr != NULL)
ptraddr = &((*ptraddr)->next);
*ptraddr = malloc(sizeof(struct listnode));
(*ptraddr)->a = i;
(*ptraddr)->b = j;
(*ptraddr)->next = NULL;
 
  


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
glibc detected *** double free or corruption (!prev): krishna_162005 Linux - Server 2 06-29-2007 08:26 AM
*** glibc detected *** double free or corruption (!prev): krishna_162005 Linux - General 1 06-27-2007 02:43 AM
glibc detected *** double free or corruption (!prev): krishna_162005 Linux - Software 1 06-27-2007 02:42 AM
double free or corruption (glibc)? bendeco13 Linux - General 5 09-11-2006 04:26 PM
*** glibc detected *** double free or corruption (C++) urzumph Programming 25 01-07-2006 04:03 PM


All times are GMT -5. The time now is 01:51 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