Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/pal/src/cruntime/malloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ CorUnix::InternalRealloc(
// If pvMemblock is NULL, there's no reason to call free.
if (pvMemblock != NULL)
{
InternalFree(pvMemblock);
free(pvMemblock);
}
pvMem = NULL;
}
Expand All @@ -76,14 +76,6 @@ __cdecl
PAL_free(
void *pvMem
)
{
InternalFree(pvMem);
}

void
CorUnix::InternalFree(
void *pvMem
)
{
free(pvMem);
}
Expand Down
78 changes: 39 additions & 39 deletions src/pal/src/cruntime/printfcpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ static int Internal_Convertfwrite(CPalThread *pthrCurrent, const void *buffer, s
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
{
Expand Down Expand Up @@ -441,7 +441,7 @@ BOOL Internal_ExtractFormatA(CPalThread *pthrCurrent, LPCSTR *Fmt, LPSTR Out, LP
}

*Out = 0; /* end the string */
InternalFree(TempStr);
free(TempStr);
return Result;
}

Expand Down Expand Up @@ -769,7 +769,7 @@ BOOL Internal_ExtractFormatW(CPalThread *pthrCurrent, LPCWSTR *Fmt, LPSTR Out, L
}

*Out = 0; /* end the string */
InternalFree(TempStr);
free(TempStr);
return Result;
}

Expand Down Expand Up @@ -947,7 +947,7 @@ INT Internal_AddPaddingVfprintf(CPalThread *pthrCurrent, PAL_FILE *stream, LPSTR
}

Done:
InternalFree(OutOriginal);
free(OutOriginal);

return Written;
}
Expand Down Expand Up @@ -998,7 +998,7 @@ static INT Internal_AddPaddingVfwprintf(CPalThread *pthrCurrent, PAL_FILE *strea
if (wcscpy_s(Out, iLen, In) != SAFECRT_SUCCESS)
{
ERROR("wcscpy_s failed!\n");
InternalFree(OutOriginal);
free(OutOriginal);
pthrCurrent->SetLastError(ERROR_INSUFFICIENT_BUFFER);
return -1;
}
Expand Down Expand Up @@ -1028,7 +1028,7 @@ static INT Internal_AddPaddingVfwprintf(CPalThread *pthrCurrent, PAL_FILE *strea
if (wcscpy_s(Out, iLen, In) != SAFECRT_SUCCESS)
{
ERROR("wcscpy_s failed!\n");
InternalFree(OutOriginal);
free(OutOriginal);
pthrCurrent->SetLastError(ERROR_INSUFFICIENT_BUFFER);
return -1;
}
Expand All @@ -1045,7 +1045,7 @@ static INT Internal_AddPaddingVfwprintf(CPalThread *pthrCurrent, PAL_FILE *strea
{
ERROR("fwrite() failed with errno == %d\n", errno);
}
InternalFree(OutOriginal);
free(OutOriginal);
}

return Written;
Expand Down Expand Up @@ -1265,7 +1265,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for
pthrCurrent->SetLastError(ERROR_NOT_ENOUGH_MEMORY);
if (WStrWasMalloced)
{
InternalFree(TempWStr);
free(TempWStr);
}
va_end(ap);
return -1;
Expand All @@ -1283,9 +1283,9 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for
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);
Expand All @@ -1312,20 +1312,20 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for
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);
return (-1);
}
written += paddingReturnValue;

InternalFree(WorkingWStr);
free(WorkingWStr);
if (WStrWasMalloced)
{
InternalFree(TempWStr);
free(TempWStr);
}
}
else if (Prefix == PFF_PREFIX_LONG && Type == PFF_TYPE_CHAR)
Expand Down Expand Up @@ -1499,7 +1499,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for
ERROR("MultiByteToWideChar failed\n");
if(TempSprintfStrPtr)
{
InternalFree(TempSprintfStrPtr);
free(TempSprintfStrPtr);
}
LOGEXIT("vfwprintf returns int -1\n");
PERF_EXIT(vfwprintf);
Expand All @@ -1516,7 +1516,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for
pthrCurrent->SetLastError(ERROR_NOT_ENOUGH_MEMORY);
if(TempSprintfStrPtr)
{
InternalFree(TempSprintfStrPtr);
free(TempSprintfStrPtr);
}
va_end(ap);
return -1;
Expand All @@ -1538,19 +1538,19 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for
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
Expand Down Expand Up @@ -1669,7 +1669,7 @@ int CoreVsnprintf(CPalThread *pthrCurrent, LPSTR Buffer, size_t Count, LPCSTR Fo
{
ASSERT("WideCharToMultiByte failed. Error is %d\n",
GetLastError());
InternalFree(TempStr);
free(TempStr);
va_end(ap);
return -1;
}
Expand All @@ -1685,7 +1685,7 @@ int CoreVsnprintf(CPalThread *pthrCurrent, LPSTR Buffer, size_t Count, LPCSTR Fo
{
ASSERT("WideCharToMultiByte failed. Error is %d\n",
GetLastError());
InternalFree(TempStr);
free(TempStr);
va_end(ap);
return -1;
}
Expand All @@ -1699,7 +1699,7 @@ int CoreVsnprintf(CPalThread *pthrCurrent, LPSTR Buffer, size_t Count, LPCSTR Fo
Width - Length,
Flags);

InternalFree(TempStr);
free(TempStr);
}
else if (Prefix == PFF_PREFIX_LONG && Type == PFF_TYPE_CHAR)
{
Expand Down Expand Up @@ -1986,7 +1986,7 @@ int CoreWvsnprintf(CPalThread *pthrCurrent, LPWSTR Buffer, size_t Count, LPCWSTR
pthrCurrent->SetLastError(ERROR_NOT_ENOUGH_MEMORY);
if (needToFree)
{
InternalFree(TempWStr);
free(TempWStr);
}
va_end(ap);
return -1;
Expand All @@ -2004,9 +2004,9 @@ int CoreWvsnprintf(CPalThread *pthrCurrent, LPWSTR Buffer, size_t Count, LPCWSTR
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);
Expand All @@ -2030,9 +2030,9 @@ int CoreWvsnprintf(CPalThread *pthrCurrent, LPWSTR Buffer, size_t Count, LPCWSTR

if (needToFree)
{
InternalFree(TempWStr);
free(TempWStr);
}
InternalFree(WorkingWStr);
free(WorkingWStr);
}
else if (Prefix == PFF_PREFIX_LONG && Type == PFF_TYPE_CHAR)
{
Expand Down Expand Up @@ -2159,7 +2159,7 @@ int CoreWvsnprintf(CPalThread *pthrCurrent, LPWSTR Buffer, size_t Count, LPCWSTR
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;
}
Expand All @@ -2172,7 +2172,7 @@ int CoreWvsnprintf(CPalThread *pthrCurrent, LPWSTR Buffer, size_t Count, LPCWSTR
{
ASSERT("MultiByteToWideChar failed. Error is %d\n",
GetLastError());
InternalFree(TempNumberBuffer);
free(TempNumberBuffer);
va_end(ap);
return -1;
}
Expand All @@ -2193,7 +2193,7 @@ int CoreWvsnprintf(CPalThread *pthrCurrent, LPWSTR Buffer, size_t Count, LPCWSTR
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;
}
Expand All @@ -2206,13 +2206,13 @@ int CoreWvsnprintf(CPalThread *pthrCurrent, LPWSTR Buffer, size_t Count, LPCWSTR
{
ASSERT("MultiByteToWideChar failed. Error is %d\n",
GetLastError());
InternalFree(TempNumberBuffer);
free(TempNumberBuffer);
va_end(ap);
return -1;
}
BufferPtr += TempInt;
}
InternalFree(TempNumberBuffer);
free(TempNumberBuffer);
}
}
else
Expand Down Expand Up @@ -2326,7 +2326,7 @@ int CoreVfprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const char *format,
{
ASSERT("WideCharToMultiByte failed. Error is %d\n",
GetLastError());
InternalFree(TempStr);
free(TempStr);
PERF_EXIT(vfprintf);
va_end(ap);
return -1;
Expand All @@ -2343,7 +2343,7 @@ int CoreVfprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const char *format,
{
ASSERT("WideCharToMultiByte failed. Error is %d\n",
GetLastError());
InternalFree(TempStr);
free(TempStr);
PERF_EXIT(vfprintf);
va_end(ap);
return -1;
Expand All @@ -2358,14 +2358,14 @@ int CoreVfprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const char *format,
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)
{
Expand Down
12 changes: 6 additions & 6 deletions src/pal/src/debug/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@ OutputDebugStringW(
{
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");
Expand Down Expand Up @@ -388,7 +388,7 @@ DebugBreakCommand()
goto FAILED;
}

InternalFree(command_string);
free(command_string);
return 1;
}

Expand All @@ -397,7 +397,7 @@ DebugBreakCommand()
FAILED:
if (command_string)
{
InternalFree(command_string);
free(command_string);
}

fprintf (stderr, "Failed to execute command: '%s'\n", command_string);
Expand Down Expand Up @@ -1519,7 +1519,7 @@ ReadProcessMemory(
CLEANUP2:
if (lpTmpBuffer)
{
InternalFree(lpTmpBuffer);
free(lpTmpBuffer);
}
#endif // !HAVE_TTRACE

Expand Down Expand Up @@ -1816,7 +1816,7 @@ WriteProcessMemory(
CLEANUP2:
if (lpTmpBuffer)
{
InternalFree(lpTmpBuffer);
free(lpTmpBuffer);
}
#endif // !HAVE_TTRACE

Expand Down
2 changes: 1 addition & 1 deletion src/pal/src/exception/machexception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ GetExceptionMask()
if (exceptionSettings)
{
exMode = (MachExceptionMode)atoi(exceptionSettings);
InternalFree(exceptionSettings);
free(exceptionSettings);
}
else
{
Expand Down
Loading