MultiByteToWideChar( CP_ACP, 0, nptr, -1, psz_tmp, i_len );
f_result = wcstod( psz_tmp, NULL );
free( psz_tmp );
MultiByteToWideChar( CP_ACP, 0, nptr, -1, psz_tmp, i_len );
f_result = wcstod( psz_tmp, NULL );
free( psz_tmp );
if ( wpath == NULL || wpath[0] == '\0'
|| (wcscmp (wpath, L"\\") == 0) )
{
/* Special mode to list drive letters */
p_dir = malloc( sizeof(vlc_DIR) );
if ( wpath == NULL || wpath[0] == '\0'
|| (wcscmp (wpath, L"\\") == 0) )
{
/* Special mode to list drive letters */
p_dir = malloc( sizeof(vlc_DIR) );
pp_list = realloc( pp_list, ( ret + 1 ) * sizeof( struct dirent * ) );
size = sizeof( struct dirent ) + strlen( p_content->d_name ) + 1;
pp_list[ret] = malloc( size );
pp_list = realloc( pp_list, ( ret + 1 ) * sizeof( struct dirent * ) );
size = sizeof( struct dirent ) + strlen( p_content->d_name ) + 1;
pp_list[ret] = malloc( size );
- memcpy( pp_list[ret], p_content, size );
- ret++;
+ if( pp_list[ret] )
+ {
+ memcpy( pp_list[ret], p_content, size );
+ ret++;
+ }
+ else
+ {
+ /* Continuing is useless when no more memory can be allocted,
+ * so better return what we have found.
+ */
+ ret = -1;
+ break;
+ }
BOOL bFuncRetn = FALSE;
HANDLE hChildStdinRd, hChildStdinWr, hChildStdoutRd, hChildStdoutWr;
DWORD i_status;
BOOL bFuncRetn = FALSE;
HANDLE hChildStdinRd, hChildStdinWr, hChildStdoutRd, hChildStdoutWr;
DWORD i_status;