func: static void goodB2G() wchar_t * data ; data = ( wchar_t * ) malloc ( 100 * sizeof ( wchar_t ) ); CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_connect_socket_84_goodB2G * goodB2GObject = new CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_connect_socket_84_goodB2G ( data ) ; CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_connect_socket_84_goodB2G::CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_connect_socket_84_goodB2G(wchar_t * dataCopy) data = dataCopy; WSADATA wsaData ; int wsaDataInit = 0 ; int recvResult ; struct sockaddr_in service ; wchar_t * replace ; SOCKET connectSocket = INVALID_SOCKET ; size_t dataLen = wcslen ( data ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR )  break ; wsaDataInit = 1; connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET )  break ; memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR )  break ; recvResult = recv ( connectSocket , ( char * ) ( data + dataLen ) , sizeof ( wchar_t ) * ( 100 - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 )  break ; data [ dataLen + recvResult / sizeof ( wchar_t ) ] = L '\0' replace = wcschr ( data , L '\r' ) if ( replace )  * replace = L '\0' replace = wcschr ( data , L '\n' ) if ( replace )  * replace = L '\0' while ( 0 )  if ( connectSocket != INVALID_SOCKET )  CLOSE_SOCKET ( connectSocket ); if ( wsaDataInit )  WSACleanup ( ); delete goodB2GObject CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_connect_socket_84_goodB2G::~CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_connect_socket_84_goodB2G() size_t i ; for (i=0; i < wcslen(data); i++) if ( data [ i ] == SEARCH_CHAR )  printLine ( "We have a match!" ); void printLine (const char * line) if ( line != NULL )  printf ( "%s\n" , line ); break ; free ( data ); 