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 8567075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:48:02+00:00 2026-06-11T17:48:02+00:00

I am getting the following type of error. I know it has something to

  • 0

I am getting the following type of error. I know it has something to do with me improperly accessing memory, but I don’t exactly how. Please help me see where I have gone wrong.

*note I have simplified my function and it is not obvious what the variables are doing, I just need to know how I am implementing the function incorrectly or where I am misusing memory access.

int my_function(char const *file_name, size_t max)
        {

        myStruct.pStore = fopen(file_name,"w+");      //pStore is a FILE* 
        myStruct.max = max;                 

        // fill the with zeros ('0')
        int numberOfZeros = max*SIZE;
        char zeros[numberOfZeros];                      

        int i=0;
        while(i<numberOfZeros)         // insert zero's 
        {
                zeros[i]='0';
                i++;
        }
        fwrite(zeros,sizeof(char),numberOfZeros,myStruct.pStore);
        fclose(myStruct.pStore);

        return EXIT_SUCCESS; 

The error I am given:

*** glibc detected *** /home/.../: double free or corruption (top): 0x0804c008 ***
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(+0x73e42)[0xb7e82e42]
/lib/i386-linux-gnu/libc.so.6(fclose+0x154)[0xb7e72384]
/home/2012/spatar/cs/specs/release[0x80486b0]
/home/2012/spatar/cs/specs/release[0x8048acd]
/home/2012/spatar/cs/specs/release[0x8048af0]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0xb7e284d3]
/home/2012/spatar/cs/specs/release[0x80484e1]
 ======= Memory map: ========
08048000-0804a000 r-xp 00000000 00:3b 2331829    /home/2012/spatar/cs/Aspecs/release
0804a000-0804b000 r--p 00001000 00:3b 2331829    /home/2012/spatar/cs/specs/release
0804b000-0804c000 rw-p 00002000 00:3b 2331829    /home/2012/spatar/cs/specs/release
0804c000-0806d000 rw-p 00000000 00:00 0          [heap]
b7e0e000-b7e0f000 rw-p 00000000 00:00 0 
b7e0f000-b7fae000 r-xp 00000000 00:11 5415       /lib/i386-linux-gnu/libc-2.15.so
b7fae000-b7fb0000 r--p 0019f000 00:11 5415       /lib/i386-linux-gnu/libc-2.15.so
b7fb0000-b7fb1000 rw-p 001a1000 00:11 5415       /lib/i386-linux-gnu/libc-2.15.so
b7fb1000-b7fb4000 rw-p 00000000 00:00 0 
b7fbc000-b7fd8000 r-xp 00000000 00:11 5426       /lib/i386-linux-gnu/libgcc_s.so.1
b7fd8000-b7fd9000 r--p 0001b000 00:11 5426       /lib/i386-linux-gnu/libgcc_s.so.1
b7fd9000-b7fda000 rw-p 0001c000 00:11 5426       /lib/i386-linux-gnu/libgcc_s.so.1
b7fda000-b7fdd000 rw-p 00000000 00:00 0 
b7fdd000-b7fde000 r-xp 00000000 00:00 0          [vdso]
b7fde000-b7ffe000 r-xp 00000000 00:11 5405       /lib/i386-linux-gnu/ld-2.15.so
b7ffe000-b7fff000 r--p 0001f000 00:11 5405       /lib/i386-linux-gnu/ld-2.15.so
b7fff000-b8000000 rw-p 00020000 00:11 5405       /lib/i386-linux-gnu/ld-2.15.so
bffdf000-c0000000 rw-p 00000000 00:00 0          [stack]
  • 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-06-11T17:48:03+00:00Added an answer on June 11, 2026 at 5:48 pm

    It looks like you are trying to free memory that has already been freed or was dereferenced.

    Link your program with efence or run it with valgrind.

    This will tell you where your pointer gets dereferenced.

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

Sidebar

Related Questions

I am getting the following error in my code: System.JSONException null Don't know the
Hi I'm getting the following error: Access restriction: The type MainFrame is not accessible
I am getting the following error when running my code: Typeerror: lambda() takes exactly
Getting following build error: error X2230: the type 'ASA.Log.ServiceLogger.IASALog' is in assembly 'ASA.Log.ServiceLogger' that
I know that something similar to this has been answered before but its not
Trying to pass GetFullNamePDF() to the Filename attribute, but getting the following error: Compile
I'm getting the following error: The type arguments for method 'System.Web.Mvc.Html.DisplayExtensions.DisplayFor<TModel,TValue>(System.Web.Mvc.HtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel,TValue>>, string)' cannot
I'm getting the following error, while using ExtJs MVC, Uncaught TypeError: Cannot call method
I have the following code however am getting the error Uncaught TypeError: Object #<addThis>
Am getting following error message on calling WCF service: The formatter threw an exception

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.