mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 05:37:44 +00:00
- improve error checking
- fix a memory leak svn path=/trunk/; revision=29445
This commit is contained in:
parent
44be754751
commit
616c7f2be3
|
@ -70,10 +70,18 @@ namespace System_
|
|||
else
|
||||
{
|
||||
cout << "NamedPipeReader::openPipe> successfully opened pipe" << endl;
|
||||
m_BufferLength = 100;
|
||||
m_Buffer = (char*)malloc(sizeof(char) * m_BufferLength);
|
||||
|
||||
if (!m_Buffer)
|
||||
{
|
||||
m_BufferLength = 100;
|
||||
m_Buffer = (char*)malloc(sizeof(char) * m_BufferLength);
|
||||
}
|
||||
|
||||
#ifdef UNICODE
|
||||
m_WBuffer = (WCHAR*)malloc(sizeof(WCHAR) * m_BufferLength);
|
||||
if (!m_WBuffer)
|
||||
{
|
||||
m_WBuffer = (WCHAR*)malloc(sizeof(WCHAR) * m_BufferLength);
|
||||
}
|
||||
#endif
|
||||
ConnectNamedPipe(h_Pipe,
|
||||
0);
|
||||
|
@ -90,8 +98,11 @@ namespace System_
|
|||
else
|
||||
{
|
||||
cout << "NamedPipeReader::openPipe> successfully opened pipe handle: "<< h_Pipe << endl << "Src: " << PipeCmd << endl;
|
||||
m_BufferLength = 100;
|
||||
m_Buffer = (char*)malloc(sizeof(char) * m_BufferLength);
|
||||
if (!m_Buffer)
|
||||
{
|
||||
m_BufferLength = 100;
|
||||
m_Buffer = (char*)malloc(sizeof(char) * m_BufferLength);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
@ -240,12 +251,14 @@ namespace System_
|
|||
if (!m_Buffer)
|
||||
{
|
||||
cerr << "Error: no memory" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef UNICODE
|
||||
if (!m_WBuffer)
|
||||
{
|
||||
cerr << "Error: no memory" << endl;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue