free(): invalid pointer

Discussion in 'C Programming' started by c language, Jun 14, 2006.

  1. c language

    c language Guest

    Hi All,

    I have written a C++ program, it can be compiled (in UNIX) but when I
    run it, I usually gives the following errors:

    free(): invalid pointer 0x51d4a0!
    free(): invalid pointer 0x51d460!
    free(): invalid pointer 0x51d760!
    free(): invalid pointer 0x51d7e0!
    ..
    ..
    ..

    Can anyone help me to know what is the reason for this problem?

    Thanks,
     
    c language, Jun 14, 2006
    #1
    1. Advertising

  2. c language

    Ian Collins Guest

    c language wrote:
    > Hi All,
    >
    > I have written a C++ program,


    Then you should go down the hall to the C++ group.

    > it can be compiled (in UNIX) but when I
    > run it, I usually gives the following errors:
    >
    > free(): invalid pointer 0x51d4a0!
    > free(): invalid pointer 0x51d460!
    > free(): invalid pointer 0x51d760!
    > free(): invalid pointer 0x51d7e0!
    > ..
    > ..
    > ..
    >
    > Can anyone help me to know what is the reason for this problem?
    >

    Passing an invalid pointer to free? When you post on the C++ group,
    include the code.

    --
    Ian Collins.
     
    Ian Collins, Jun 14, 2006
    #2
    1. Advertising

  3. c language wrote:
    > Hi All,
    >
    > I have written a C++ program, it can be compiled (in UNIX) but when I
    > run it, I usually gives the following errors:
    >
    > free(): invalid pointer 0x51d4a0!
    > free(): invalid pointer 0x51d460!
    > free(): invalid pointer 0x51d760!
    > free(): invalid pointer 0x51d7e0!
    >
    > Can anyone help me to know what is the reason for this problem?


    Why don't you try posting your question, along with a small, complete,
    compilable example that demonstrates your issue, to comp.lang.c++. It
    is very difficult to know exactly what the problem is without seeing
    your code although, and I am going out on a limb here, you may be
    trying to free an invalid pointer (i.e. a pointer that was not returned
    to you by malloc and friends).

    Robert Gamble
     
    Robert Gamble, Jun 14, 2006
    #3
  4. c language

    seni.yin Guest

    make sure the memory your pointer point to is allocated by fuction
    "malloc"!
     
    seni.yin, Jun 14, 2006
    #4
  5. c language

    Michael Mair Guest

    seni.yin schrieb:
    > make sure the memory your pointer point to is allocated by fuction
    > "malloc"!


    What are you responding to? Please quote sufficient context.
    The above may be right or wrong, depending on the context.

    Cheers
    Michael
    --
    E-Mail: Mine is an /at/ gmx /dot/ de address.
     
    Michael Mair, Jun 14, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lucas Machado

    pointer-to-pointer (invalid lvalue in unary `&)

    Lucas Machado, Apr 3, 2004, in forum: C Programming
    Replies:
    19
    Views:
    11,023
    Irrwahn Grausewitz
    Apr 15, 2004
  2. Replies:
    17
    Views:
    531
    Chris Dollin
    Feb 26, 2007
  3. Cyron

    free(): invalid pointer:

    Cyron, Sep 30, 2007, in forum: C Programming
    Replies:
    3
    Views:
    425
    Richard Tobin
    Sep 30, 2007
  4. george
    Replies:
    0
    Views:
    1,145
    george
    Aug 29, 2008
  5. mohammed_a_o
    Replies:
    0
    Views:
    287
    mohammed_a_o
    Nov 30, 2010
Loading...

Share This Page