// If pvMemblock is NULL, there's no reason to call free.
if (pvMemblock != NULL)
{
- InternalFree(pvMemblock);
+ free(pvMemblock);
}
pvMem = NULL;
}
void *pvMem
)
{
- InternalFree(pvMem);
-}
-
-void
-CorUnix::InternalFree(
- void *pvMem
- )
-{
free(pvMem);
}
if (!nsize)
{
ASSERT("WideCharToMultiByte failed. Error is %d\n", GetLastError());
- InternalFree(newBuff);
+ free(newBuff);
return -1;
}
ret = InternalFwrite(newBuff, 1, count, stream, &iError);
if (iError != 0)
{
ERROR("InternalFwrite did not write the whole buffer. Error is %d\n", iError);
- InternalFree(newBuff);
+ free(newBuff);
return -1;
}
- InternalFree(newBuff);
+ free(newBuff);
}
else
{
}
*Out = 0; /* end the string */
- InternalFree(TempStr);
+ free(TempStr);
return Result;
}
}
*Out = 0; /* end the string */
- InternalFree(TempStr);
+ free(TempStr);
return Result;
}
}
Done:
- InternalFree(OutOriginal);
+ free(OutOriginal);
return Written;
}
if (wcscpy_s(Out, iLen, In) != SAFECRT_SUCCESS)
{
ERROR("wcscpy_s failed!\n");
- InternalFree(OutOriginal);
+ free(OutOriginal);
pthrCurrent->SetLastError(ERROR_INSUFFICIENT_BUFFER);
return -1;
}
if (wcscpy_s(Out, iLen, In) != SAFECRT_SUCCESS)
{
ERROR("wcscpy_s failed!\n");
- InternalFree(OutOriginal);
+ free(OutOriginal);
pthrCurrent->SetLastError(ERROR_INSUFFICIENT_BUFFER);
return -1;
}
{
ERROR("fwrite() failed with errno == %d\n", errno);
}
- InternalFree(OutOriginal);
+ free(OutOriginal);
}
return Written;
pthrCurrent->SetLastError(ERROR_NOT_ENOUGH_MEMORY);
if (WStrWasMalloced)
{
- InternalFree(TempWStr);
+ free(TempWStr);
}
va_end(ap);
return -1;
ERROR("Internal_AddPaddingVfwprintf failed\n");
if (WStrWasMalloced)
{
- InternalFree(TempWStr);
+ free(TempWStr);
}
- InternalFree(WorkingWStr);
+ free(WorkingWStr);
LOGEXIT("wcsncpy_s failed!\n");
PERF_EXIT(vfwprintf);
va_end(ap);
ERROR("Internal_AddPaddingVfwprintf failed\n");
if (WStrWasMalloced)
{
- InternalFree(TempWStr);
+ free(TempWStr);
}
- InternalFree(WorkingWStr);
+ free(WorkingWStr);
LOGEXIT("vfwprintf returns int -1\n");
PERF_EXIT(vfwprintf);
va_end(ap);
}
written += paddingReturnValue;
- InternalFree(WorkingWStr);
+ free(WorkingWStr);
if (WStrWasMalloced)
{
- InternalFree(TempWStr);
+ free(TempWStr);
}
}
else if (Prefix == PFF_PREFIX_LONG && Type == PFF_TYPE_CHAR)
ERROR("MultiByteToWideChar failed\n");
if(TempSprintfStrPtr)
{
- InternalFree(TempSprintfStrPtr);
+ free(TempSprintfStrPtr);
}
LOGEXIT("vfwprintf returns int -1\n");
PERF_EXIT(vfwprintf);
pthrCurrent->SetLastError(ERROR_NOT_ENOUGH_MEMORY);
if(TempSprintfStrPtr)
{
- InternalFree(TempSprintfStrPtr);
+ free(TempSprintfStrPtr);
}
va_end(ap);
return -1;
ERROR("fwrite() failed with errno == %d (%s)\n", errno, strerror(errno));
LOGEXIT("vfwprintf returns int -1\n");
PERF_EXIT(vfwprintf);
- InternalFree(TempWideBuffer);
+ free(TempWideBuffer);
if(TempSprintfStrPtr)
{
- InternalFree(TempSprintfStrPtr);
+ free(TempSprintfStrPtr);
}
va_end(ap);
return -1;
}
if(TempSprintfStrPtr)
{
- InternalFree(TempSprintfStrPtr);
+ free(TempSprintfStrPtr);
}
- InternalFree(TempWideBuffer);
+ free(TempWideBuffer);
}
}
else
{
ASSERT("WideCharToMultiByte failed. Error is %d\n",
GetLastError());
- InternalFree(TempStr);
+ free(TempStr);
va_end(ap);
return -1;
}
{
ASSERT("WideCharToMultiByte failed. Error is %d\n",
GetLastError());
- InternalFree(TempStr);
+ free(TempStr);
va_end(ap);
return -1;
}
Width - Length,
Flags);
- InternalFree(TempStr);
+ free(TempStr);
}
else if (Prefix == PFF_PREFIX_LONG && Type == PFF_TYPE_CHAR)
{
pthrCurrent->SetLastError(ERROR_NOT_ENOUGH_MEMORY);
if (needToFree)
{
- InternalFree(TempWStr);
+ free(TempWStr);
}
va_end(ap);
return -1;
ERROR("CoreWvsnprintf failed\n");
if (needToFree)
{
- InternalFree(TempWStr);
+ free(TempWStr);
}
- InternalFree(WorkingWStr);
+ free(WorkingWStr);
LOGEXIT("wcsncpy_s failed!\n");
PERF_EXIT(wvsnprintf);
va_end(ap);
if (needToFree)
{
- InternalFree(TempWStr);
+ free(TempWStr);
}
- InternalFree(WorkingWStr);
+ free(WorkingWStr);
}
else if (Prefix == PFF_PREFIX_LONG && Type == PFF_TYPE_CHAR)
{
if (strncpy_s(TempNumberBuffer, TempCount+1, (LPSTR) BufferPtr, TempCount) != SAFECRT_SUCCESS)
{
ASSERT("strncpy_s failed!\n");
- InternalFree(TempNumberBuffer);
+ free(TempNumberBuffer);
va_end(ap);
return -1;
}
{
ASSERT("MultiByteToWideChar failed. Error is %d\n",
GetLastError());
- InternalFree(TempNumberBuffer);
+ free(TempNumberBuffer);
va_end(ap);
return -1;
}
if (strncpy_s(TempNumberBuffer, TempInt+1, (LPSTR) BufferPtr, TempInt) != SAFECRT_SUCCESS)
{
ASSERT("strncpy_s failed!\n");
- InternalFree(TempNumberBuffer);
+ free(TempNumberBuffer);
va_end(ap);
return -1;
}
{
ASSERT("MultiByteToWideChar failed. Error is %d\n",
GetLastError());
- InternalFree(TempNumberBuffer);
+ free(TempNumberBuffer);
va_end(ap);
return -1;
}
BufferPtr += TempInt;
}
- InternalFree(TempNumberBuffer);
+ free(TempNumberBuffer);
}
}
else
{
ASSERT("WideCharToMultiByte failed. Error is %d\n",
GetLastError());
- InternalFree(TempStr);
+ free(TempStr);
PERF_EXIT(vfprintf);
va_end(ap);
return -1;
{
ASSERT("WideCharToMultiByte failed. Error is %d\n",
GetLastError());
- InternalFree(TempStr);
+ free(TempStr);
PERF_EXIT(vfprintf);
va_end(ap);
return -1;
if (-1 == paddingReturnValue)
{
ERROR("Internal_AddPaddingVfprintf failed\n");
- InternalFree(TempStr);
+ free(TempStr);
PERF_EXIT(vfprintf);
va_end(ap);
return -1;
}
written += paddingReturnValue;
- InternalFree(TempStr);
+ free(TempStr);
}
else if (Prefix == PFF_PREFIX_LONG && Type == PFF_TYPE_CHAR)
{
{
ASSERT("failed to convert wide chars to multibytes\n");
SetLastError(ERROR_INTERNAL_ERROR);
- InternalFree(lpOutputStringA);
+ free(lpOutputStringA);
goto EXIT;
}
OutputDebugStringA(lpOutputStringA);
- InternalFree(lpOutputStringA);
+ free(lpOutputStringA);
EXIT:
LOGEXIT("OutputDebugStringW returns\n");
goto FAILED;
}
- InternalFree(command_string);
+ free(command_string);
return 1;
}
FAILED:
if (command_string)
{
- InternalFree(command_string);
+ free(command_string);
}
fprintf (stderr, "Failed to execute command: '%s'\n", command_string);
CLEANUP2:
if (lpTmpBuffer)
{
- InternalFree(lpTmpBuffer);
+ free(lpTmpBuffer);
}
#endif // !HAVE_TTRACE
CLEANUP2:
if (lpTmpBuffer)
{
- InternalFree(lpTmpBuffer);
+ free(lpTmpBuffer);
}
#endif // !HAVE_TTRACE
if (exceptionSettings)
{
exMode = (MachExceptionMode)atoi(exceptionSettings);
- InternalFree(exceptionSettings);
+ free(exceptionSettings);
}
else
{
*lpErrorCode = ERROR_FILE_NOT_FOUND;
}
- InternalFree(lpDupedPath);
+ free(lpDupedPath);
lpDupedPath = NULL;
TRACE( "FILEGetProperNotFoundError returning TRUE\n" );
return;
path_size = MultiByteToWideChar( CP_ACP, 0, tempfile_name, -1,
lpTempFileName, MAX_LONGPATH );
- InternalFree(tempfile_name);
+ free(tempfile_name);
tempfile_name = NULL;
if (!path_size)
{
goto done;
}
- InternalFree(lpUnixPath);
+ free(lpUnixPath);
lpUnixPath = strdup(lpNewFileName);
if ( lpUnixPath == NULL )
{
}
if (lpUnixPath)
{
- InternalFree(lpUnixPath);
+ free(lpUnixPath);
}
LOGEXIT("CopyFileA returns BOOL %d\n", bGood);
pThread->SetLastError(dwLastError);
}
- InternalFree(unixFileName);
+ free(unixFileName);
LOGEXIT("SetFileAttributesA returns BOOL %d\n", bRet);
PERF_EXIT(SetFileAttributesA);
}
}
}
- InternalFree(lpTemp);
+ free(lpTemp);
lpTemp = NULL;
goto done;
}
{
globfree( &(find_data->gGlob) );
}
- InternalFree(find_data);
+ free(find_data);
}
if (dwLastError)
{
{
globfree( &(find_data->gGlob) );
}
- InternalFree(find_data);
+ free(find_data);
done:
if (dwLastError)
if (NULL != m_rghteHandleTable)
{
- InternalFree(m_rghteHandleTable);
+ free(m_rghteHandleTable);
}
}
size_t szSize
);
- void
- InternalFree(
- void *pvMem
- );
-
// Define common code for "new" style allocators below.
#define INTERNAL_NEW_COMMON() \
T *pMem = (T*)InternalMalloc(sizeof(T)); \
if (p)
{
p->~T();
- InternalFree(p);
+ free(p);
}
}
size_t cElements = *pRealMem;
for (size_t i = 0; i < cElements; i++)
p[i].~T();
- InternalFree(pRealMem);
+ free(pRealMem);
}
}
}
CLEANUP5:
PROCCleanupInitialProcess();
CLEANUP2:
- InternalFree(exe_path);
+ free(exe_path);
CLEANUP1e:
- InternalFree(command_line);
+ free(command_line);
CLEANUP1d:
// Cleanup synchronization manager
CLEANUP1c:
if (i == 0)
{
ASSERT("MultiByteToWideChar failure\n");
- InternalFree(command_line);
+ free(command_line);
return NULL;
}
if(retval == NULL)
{
ERROR("can't allocate memory for Unicode command line!\n");
- InternalFree(command_line);
+ free(command_line);
return NULL;
}
if(!MultiByteToWideChar(CP_ACP, 0,command_line, i, retval, i))
{
ASSERT("MultiByteToWideChar failure\n");
- InternalFree(retval);
+ free(retval);
retval = NULL;
}
else
TRACE("Command line is %s\n", command_line);
- InternalFree(command_line);
+ free(command_line);
return retval;
}
return_value, return_size))
{
ASSERT("MultiByteToWideChar failure\n");
- InternalFree(return_value);
+ free(return_value);
return_value = NULL;
}
else
WARN("$PATH isn't set.\n");
if (env_path != NULL)
{
- InternalFree(env_path);
+ free(env_path);
}
goto last_resort;
if (strcpy_s(full_path, iLength, cur_dir) != SAFECRT_SUCCESS)
{
ERROR("strcpy_s failed!\n");
- InternalFree(full_path);
- InternalFree(env_path);
+ free(full_path);
+ free(env_path);
return NULL;
}
if (strcat_s(full_path, iLength, "/") != SAFECRT_SUCCESS)
{
ERROR("strcat_s failed!\n");
- InternalFree(full_path);
- InternalFree(env_path);
+ free(full_path);
+ free(env_path);
return NULL;
}
}
if (strcat_s(full_path, iLength, exe_name) != SAFECRT_SUCCESS)
{
ERROR("strcat_s failed!\n");
- InternalFree(full_path);
- InternalFree(env_path);
+ free(full_path);
+ free(env_path);
return NULL;
}
if (!CorUnix::RealPathHelper(full_path, real_path))
{
ERROR("realpath() failed!\n");
- InternalFree(full_path);
- InternalFree(env_path);
+ free(full_path);
+ free(env_path);
return NULL;
}
- InternalFree(full_path);
+ free(full_path);
return_size = MultiByteToWideChar(CP_ACP,0,real_path,-1,NULL,0);
if ( 0 == return_size )
{
ASSERT("MultiByteToWideChar failure\n");
- InternalFree(env_path);
+ free(env_path);
return NULL;
}
if ( NULL == return_value )
{
ERROR("Not enough memory to create full path\n");
- InternalFree(env_path);
+ free(env_path);
return NULL;
}
return_size))
{
ASSERT("MultiByteToWideChar failure\n");
- InternalFree(return_value);
+ free(return_value);
return_value = NULL;
}
else
cur_dir,real_path.GetString());
}
- InternalFree(env_path);
+ free(env_path);
return return_value;
}
}
/* file doesn't exist : keep searching */
- InternalFree(full_path);
+ free(full_path);
/* path_ptr is NULL if there's no ':' after this directory */
cur_dir=path_ptr;
}
- InternalFree(env_path);
+ free(env_path);
TRACE("No %s found in $PATH (%s)\n", exe_name, EnvironGetenv("PATH", FALSE));
last_resort:
return_value, return_size))
{
ASSERT("MultiByteToWideChar failure\n");
- InternalFree(return_value);
+ free(return_value);
return_value = NULL;
}
else
return_value, return_size))
{
ASSERT("MultiByteToWideChar failure\n");
- InternalFree(return_value);
+ free(return_value);
return_value = NULL;
}
else
Done:
if (lpstr != nullptr)
{
- InternalFree(lpstr);
+ free(lpstr);
}
LOGEXIT("LoadLibraryExA returns HMODULE %p\n", hModule);
loadedBase = MAPMapPEFile(hFile); // load it again
}
- InternalFree(envVar);
+ free(envVar);
}
}
#endif // _DEBUG
LockModuleList();
// Save the exe path in the exe module struct
- InternalFree(exe_module.lib_name);
+ free(exe_module.lib_name);
exe_module.lib_name = name;
// For platforms where we can't trust the handle to be constant, we need to
exit:
if (pszExeName)
{
- InternalFree(pszExeName);
+ free(pszExeName);
}
#endif
UnlockModuleList();
}
/* release all memory */
- InternalFree(module->lib_name);
- InternalFree(module);
+ free(module->lib_name);
+ free(module);
retval = TRUE;
if (nullptr == wide_name)
{
ERROR("couldn't convert name to a wide-character string\n");
- InternalFree(module);
+ free(module);
return nullptr;
}
iLQRetVal = loadquery(L_GETINFO, pLoadQueryBuf, cbBuf);
if (iLQRetVal < 0)
{
- InternalFree(pThread, pLoadQueryBuf);
+ free(pThread, pLoadQueryBuf);
pLoadQueryBuf = NULL;
DWORD dwLastError = GetLastError();
if (dwLastError == ERROR_NOT_ENOUGH_MEMORY)
}
Done:
if (pLoadQueryBuf)
- InternalFree(pThread, pLoadQueryBuf);
+ free(pThread, pLoadQueryBuf);
return iRetVal;
}
#endif // defined(_AIX)
ERROR( "Failed setting protections on reused mapping\n");
NativeMapHolderRelease(pThread, pReusedMapping->pNMHolder);
- InternalFree(pReusedMapping);
+ free(pReusedMapping);
pReusedMapping = NULL;
}
}
{
pNewView->pFileMapping->ReleaseReference(pThread);
RemoveEntryList(&pNewView->Link);
- InternalFree(pNewView);
+ free(pNewView);
palError = ERROR_INTERNAL_ERROR;
}
#endif // ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS
RemoveEntryList(&pView->Link);
pMappingObject = pView->pFileMapping;
- InternalFree(pView);
+ free(pView);
InternalUnmapViewOfFileExit:
TRACE( "Successfully unmapped %p (size=%lu)\n",
thisNMH->address, (unsigned long)thisNMH->size);
}
- InternalFree (thisNMH);
+ free (thisNMH);
}
else if (ret < 0)
{
TRACE_(LOADER)("Forcing rebase of image\n");
}
- InternalFree(envVar);
+ free(envVar);
}
void * pForceRelocBase;
{
pFileObject->ReleaseReference(pThread);
}
- InternalFree(pView); // this leaves pLink dangling
+ free(pView); // this leaves pLink dangling
}
TRACE_(LOADER)("MAPUnmapPEFile returning %d\n", retval);
{
WARN( "The memory at %d was not freed through a call to VirtualFree.\n",
pEntry->startBoundary );
- InternalFree(pEntry->pAllocState);
- InternalFree(pEntry->pProtectionState );
+ free(pEntry->pAllocState);
+ free(pEntry->pProtectionState );
pTempEntry = pEntry;
pEntry = pEntry->pNext;
- InternalFree(pTempEntry );
+ free(pTempEntry );
}
pVirtualMemory = NULL;
}
}
- InternalFree( pMemoryToBeReleased->pAllocState );
+ free( pMemoryToBeReleased->pAllocState );
pMemoryToBeReleased->pAllocState = NULL;
- InternalFree( pMemoryToBeReleased->pProtectionState );
+ free( pMemoryToBeReleased->pProtectionState );
pMemoryToBeReleased->pProtectionState = NULL;
- InternalFree( pMemoryToBeReleased );
+ free( pMemoryToBeReleased );
pMemoryToBeReleased = NULL;
return bRetVal;
{
ERROR( "Unable to allocate memory for the structure.\n");
- if (pNewEntry->pProtectionState) InternalFree(pNewEntry->pProtectionState);
+ if (pNewEntry->pProtectionState) free(pNewEntry->pProtectionState);
pNewEntry->pProtectionState = nullptr;
- if (pNewEntry->pAllocState) InternalFree(pNewEntry->pAllocState);
+ if (pNewEntry->pAllocState) free(pNewEntry->pAllocState);
pNewEntry->pAllocState = nullptr;
- InternalFree(pNewEntry);
+ free(pNewEntry);
pNewEntry = nullptr;
return FALSE;
bRetVal = TRUE;
#ifdef __APPLE__
- // This is patterned off of InternalFree in malloc.cpp.
{
malloc_zone_free((malloc_zone_t *)hHeap, lpMem);
}
if (checkAlignmentSettings && shouldFreeCheckAlignmentSettings)
{
- InternalFree(checkAlignmentSettings);
+ free(checkAlignmentSettings);
}
}
if (displayDialog)
{
int i = atoi(displayDialog);
- InternalFree(displayDialog);
+ free(displayDialog);
switch (i)
{
if (memcmp(name, palEnvironment[i], nameLength) == 0)
{
// Free the string we're removing.
- InternalFree(palEnvironment[i]);
+ free(palEnvironment[i]);
// Move the last environment variable pointer here.
palEnvironment[i] = palEnvironment[palEnvironmentCount - 1];
copy[nameLength] = '\0';
EnvironUnsetenv(copy);
- InternalFree(copy);
+ free(copy);
result = TRUE;
}
{
if (memcmp(entry, palEnvironment[i], nameLength) == 0)
{
- InternalFree(palEnvironment[i]);
+ free(palEnvironment[i]);
palEnvironment[i] = copy;
result = TRUE;
int resizeRet = ResizeEnvironment(palEnvironmentCapacity * 2);
if (resizeRet != TRUE)
{
- InternalFree(copy);
+ free(copy);
goto done;
}
}
CPalString::FreeBuffer()
{
_ASSERTE(NULL != m_pwsz);
- InternalFree(const_cast<WCHAR*>(m_pwsz));
+ free(const_cast<WCHAR*>(m_pwsz));
}
if (NULL != m_pvImmutableData)
{
- InternalFree(m_pvImmutableData);
+ free(m_pvImmutableData);
}
if (NULL != m_pvLocalData)
{
- InternalFree(m_pvLocalData);
+ free(m_pvLocalData);
}
if (NULL != m_oa.sObjectName.GetString())
m_pot->GetSharedDataSize()
);
- InternalFree(m_pvSharedData);
+ free(m_pvSharedData);
m_pvSharedData = pvSharedData;
}
if (NULL != m_pvSharedData && ProcessLocalObject == m_ObjectDomain)
{
- InternalFree(m_pvSharedData);
+ free(m_pvSharedData);
}
else if (SHMNULL != m_shmod && m_fDeleteSharedData)
{
{
if (!m_cancel && m_buffer != nullptr)
{
- InternalFree(m_buffer);
+ free(m_buffer);
}
}
lpProcessInformation
);
done:
- InternalFree(ApplicationNameW);
- InternalFree(CommandLineW);
- InternalFree(CurrentDirectoryW);
+ free(ApplicationNameW);
+ free(CommandLineW);
+ free(CurrentDirectoryW);
if (NO_ERROR != palError)
{
if (EnvironmentArray)
{
- InternalFree(EnvironmentArray);
+ free(EnvironmentArray);
}
/* if we still have the file structures at this point, it means we
/* free allocated memory */
if (lppArgv)
{
- InternalFree(*lppArgv);
- InternalFree(lppArgv);
+ free(*lppArgv);
+ free(lppArgv);
}
return palError;
for (ProcessModules *entry = listHead; entry != NULL; )
{
ProcessModules *next = entry->Next;
- InternalFree(entry);
+ free(entry);
entry = next;
}
}
if (wcscpy_s(initial_dir, iLen, lpwstrFullPath) != SAFECRT_SUCCESS)
{
ERROR("wcscpy_s failed!\n");
- InternalFree(initial_dir);
+ free(initial_dir);
palError = ERROR_INTERNAL_ERROR;
goto exit;
}
lpwstr[0] = '/';
- InternalFree(g_lpwstrAppDir);
+ free(g_lpwstrAppDir);
g_lpwstrAppDir = initial_dir;
}
- InternalFree(g_lpwstrCmdLine);
+ free(g_lpwstrCmdLine);
g_lpwstrCmdLine = lpwstrCmdLine;
exit:
CPalThread *pThread = InternalGetCurrentThread();
InternalEnterCriticalSection(pThread, &g_csProcess);
-
+
/* Free the application directory */
- InternalFree(g_lpwstrAppDir);
-
+ free(g_lpwstrAppDir);
+
/* Free the stored command line */
- InternalFree(g_lpwstrCmdLine);
+ free(g_lpwstrCmdLine);
InternalLeaveCriticalSection(pThread, &g_csProcess);
pChar, iWlen+1, NULL, NULL))
{
ASSERT("Unable to convert to a multibyte string\n");
- InternalFree(lpAsciiCmdLine);
+ free(lpAsciiCmdLine);
return NULL;
}
}
if (lppArgv == NULL)
{
- InternalFree(lpAsciiCmdLine);
+ free(lpAsciiCmdLine);
return NULL;
}
if (!lpPathFileName.Reserve(nextLen + lpFileNameString.GetCount() + 1))
{
- InternalFree(lpPath);
+ free(lpPath);
ERROR("StackString ran out of memory for full path\n");
return FALSE;
}
if ( access (lpPathFileName, F_OK) == 0)
{
TRACE("Found %s in $PATH element %s\n", lpFileName, lpNext);
- InternalFree(lpPath);
+ free(lpPath);
return TRUE;
}
lpNext = lpCurrent; /* search in the next directory */
}
- InternalFree(lpPath);
+ free(lpPath);
TRACE("File %s not found in $PATH\n", lpFileName);
return FALSE;
}
CPalThread::s_dwDefaultThreadStackSize = dw;
}
- InternalFree(pszStackSize);
+ free(pszStackSize);
}
return palError;