You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the function second(), the assignment word = "ab"; assigns a new pointer to word, overwriting the pointer obtained through malloc(). When you call free() on the pointer later on, the program crashes because you pass a pointer to free() that has not been obtained through malloc().
Assigning string literals does not have the effect of copying their content as you might have thought. To copy the content of a string literal, use strcpy()
(or strdup in our case ?)
munmap_chunk() is an internal function of the libc's memory management routine. This error message means that by writing into memory that does not belong to an object (but belongs to your process so no segfault), you corrupted internal data structures belonging to these routines. Trying to use these corrupted data structures, the internal routines crash.
WTF is this ?
echo $_ | wc
munmap_chunk(): invalid pointer
c 0 0 0
expected:
no invalid pointer
wc values for the echo as normal
The text was updated successfully, but these errors were encountered: