Advertisement

Error Message

Started by September 28, 2001 10:31 AM
0 comments, last by Checksum 23 years, 1 month ago
Has anyone ever experienced the error *Z_Free: Memory Block wrote past end*? Thanks in advance, {CS}
When you delete''d or free()''d an object, it detected that you wrote past the end of it, perhaps you have code like this:

  char mystring[] = "Hello World";char *buffer = new char[strlen(mystring)];strcpy( buffer, mystring );  


Your call to new[strlen(mystring)] didn''t allocate space for the trailing null that gets added to the end of the string, so when you delete[] that array, you''ll get an error like the one you described.

codeka.com - Just click it.

This topic is closed to new replies.

Advertisement