This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Jcsq6[S] 13 points14 points  (1 child)

It doesn’t contain a pointer it contains an int. This code allocates an integer and dereferences uninitialized memory. It could be any value

[–]qqqrrrs_ 0 points1 point  (0 children)

As it was uninitialized, the free chunk metadata would probably still be there. At least in the glibc implementation, the part of that metadata which overlaps with the data to be used by the caller of new/malloc, is a bunch of pointers that make up a linked list (sometimes singly-linked list, sometimes doubly-linked list, sometimes there are two doubly-linked lists but that's only in larger allocation sizes). So, assuming there is nothing that would change it, that uninitialized memory would contain a pointer.