• Anonymous (unregistered)

    You need to make a local copy of the pointer to the next before you call free - or put the recursive call at the front .

  • Dave (unregistered) in reply to Dani

    I know the guy that wrote this code. He now works for Google.

  • (cs) in reply to defrost
    defrost:
    Just for the record;
    free( head );  // does *NOT* make head==NULL
    

    and so FreeThisSchnizzle( head->next ); will NOT dereference a NULL ptr, it will pass the value at offset of member next after the pointer head, which still retains it's previous pointer value.

    What actually happens is implementation dependant, behaviour will range from "works as expected" to a segfault / bus error ...

    -1 point for the wrong "its".

  • banana (unregistered) in reply to
    :
    You're excuzzled.
    FTFY
  • (cs)

    Snoop just made a guest appearance on the Martha Stewart Show: Part I Part II

  • Daniel (unregistered)

    The main problem is that he is using the pointer after it was freed. Which might work most of the time on non-concurrent enviroments using certain types of allocator, but it's still wrong.

  • Ryan (unregistered)

    I went to class with this guy; we were both CS '06 students and were in the same freshman dorm.

  • T-Shirt (unregistered)

    I want a T-shirt with "FreeThisSchnizzle()" written on the front. On the back it will say "I just overflowed my stack."

  • Jacek (unregistered) in reply to Justin Lovell
    Justin Lovell:
    I do not know why some people are surprised at stupid names? When it comes down to code that will be looked at only once and is not a "critical" piece of code for my classes, I have some stuff like this:

    program SomeStupidTestThatWasDecidedToBeWrittenOneDayBeforeHolidays;

    begin writeln('You are a stupid user! And because I am the most intelligent piece of code, I can predict that you want to exit out this programme right now... press any key to exit.'); readkey;

    writeln('Fooled yea! The stupid piece of code will be executed momentarily...');
    delay(10000);
    
    {... actual code ...}
    

    end.

    Jeez! This is what I do for fun just BECAUSE I have to code in Pascal for school.

    That won't compile. It'll fail at readkey, as it is declared in Crt module and you didn't write uses Crt;.

Leave a comment on “FreeThisSchnizzle()”

Log In or post as a guest

Replying to comment #:

« Return to Article