func: void bad() wchar_t * data ; data = ( wchar_t * ) malloc ( 100 * sizeof ( wchar_t ) ); CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_console_84_bad * badObject = new CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_console_84_bad ( data ) ; CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_console_84_bad::CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_console_84_bad(wchar_t * dataCopy) data = dataCopy; size_t dataLen = wcslen ( data ) ; if ( 100 - dataLen > 1 )  if ( fgetws ( data + dataLen , ( int ) ( 100 - dataLen ) , stdin ) != NULL )  dataLen = wcslen ( data ); if ( dataLen > 0 && data [ dataLen - 1 ] == L '\n' ) data [ dataLen - 1 ] = L '\0' printLine ( "fgetws() failed" ); void printLine (const char * line) if ( line != NULL )  printf ( "%s\n" , line ); data [ dataLen ] = L '\0' delete badObject CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_console_84_bad::~CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_console_84_bad() for (  * data != L '\0' data ++ ) if ( * data == SEARCH_CHAR )  free ( data ); 