public
anonymous / gist:3650840
Created

a bad code

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7
malloc(103+aString.size()+4);
 
//Allocate a little space to hold a record composed of various fields
//103 = sum of field sizes, including the max length (externally specified) of string fields but not their null terminators when represented as C-strings
//aString.size() - but only the actual length of this string, for some reason.
//4 = space for a null terminator for each string field
//Original didn't have these explanatory comments

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.