Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6723331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:33:23+00:00 2026-05-26T09:33:23+00:00

I do realize there are some glibc detected posts but I would be very

  • 0

I do realize there are some “glibc detected” posts but I would be very grateful if you could suggest a solution for this:

*** glibc detected *** ./a.out: double free or corruption (top): 0x08901d70 ***
======= Backtrace: =========
/lib/libc.so.6(+0x6c501)[0x17c501]
/lib/libc.so.6(+0x6dd70)[0x17dd70]
/lib/libc.so.6(cfree+0x6d)[0x180e5d]
/lib/libc.so.6(fclose+0x14a)[0x16c81a]
./a.out[0x8048998]
/lib/libpthread.so.0(+0x5cc9)[0xc1fcc9]
/lib/libc.so.6(clone+0x5e)[0x1e069e]
======= Memory map: ========

This seems to happen when I attempt to free a binary search tree:

void freetree(BNODEPTR *root)
{
        if(root!=NULL)
        {
                freetree(root->left);
                freetree(root->right);
                free(root);
        }
}  

The structure is typedef’d to BNODEPTR

struct bnode{
        int info;
        int count;
        struct bnode* left;
        struct bnode* right;
};

I am calling the function from main() using freetree(root).

The tree seems to be implemented correctly as an inorder traversal produces a sorted output.

The entire code is at:

http://pastebin.com/Eieu3xDa and

http://pastebin.com/jtGN6XKj

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:33:24+00:00Added an answer on May 26, 2026 at 9:33 am

    I could sift through your source code, but as they say, “Feed a man a fish…”

    1. Compile your code with debugging symbols (pass -g to the compiler). If you do this, you can get a function name instead of ./a.out[0x8048998] in the backtrace.

    2. Run your code with Valgrind’s memcheck tool (the default tool). This might give you a much better clue about where the error is. You can just install Valgrind and run valgrind ./a.out for starters.

    In particular, I think the whole binary tree is a red herring. There is another problem in your program somewhere else. From the backtrace, I can see that (1) the error message is not triggered in freetree and (2) you are using threads, which are easily misused.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize there's no definitely right answer to this question, but when people talk
I realize there are similar questions on this topic, but I still cannot find
I realize there are several topics about this issue, but none provides a working
Having read some postings here about this topic, I realize that there are quite
I realize that this might be a duplicate question but this question is very
I realize this isn't terrific from a security perspective but humor me. Is there
I realize that since UNIX sockets are platform-specific, there has to be some non-Java
I realize there is a somewhat related thread on this here: Loading assemblies and
I realize there's a way in Vim to hide/fold lines, but what I'm looking
I would like to quickly send email from the command line. I realize there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.