fix build warning and a memory leak

This commit is contained in:
pan-wang 2016-09-23 10:59:40 -07:00
parent c6b3bb1243
commit 191e14b276
6 changed files with 28 additions and 3 deletions

View File

@ -66,6 +66,13 @@ public:
delete m_pFileWatcher;
m_pFileWatcher = NULL;
}
if(m_pHttp502ErrorPage != NULL)
{
delete m_pHttp502ErrorPage;
m_pHttp502ErrorPage = NULL;
}
}
FILE_WATCHER*

View File

@ -151,6 +151,10 @@ APPLICATION_MANAGER::Get502ErrorPage(
pHttp502ErrorPage->FromMemory.pBuffer = (PVOID)m_pstrErrorInfo;
pHttp502ErrorPage->FromMemory.BufferLength = (ULONG)strnlen(m_pstrErrorInfo, maxsize); //(ULONG)(wcslen(m_pstrErrorInfo)); // *sizeof(WCHAR);
if(m_pHttp502ErrorPage != NULL)
{
delete m_pHttp502ErrorPage;
}
m_pHttp502ErrorPage = pHttp502ErrorPage;
*ppErrorPage = m_pHttp502ErrorPage;
}

View File

@ -129,7 +129,7 @@ SERVER_PROCESS::StartProcess(
WCHAR* pszPath = NULL;
WCHAR pszFullPath[_MAX_PATH];
LPCWSTR apsz[1];
PCWSTR pszAppPath = NULL;
PCWSTR pszAppPath = NULL;
GetStartupInfoW(&startupInfo);
@ -457,8 +457,11 @@ SERVER_PROCESS::StartProcess(
while (*(pszCurrentEnvironment + dwCurrentEnvSize++) != 0);
} while (*(pszCurrentEnvironment + dwCurrentEnvSize++) != 0);
mszNewEnvironment.Append(pszCurrentEnvironment, dwCurrentEnvSize + 1 );
DBG_ASSERT(dwCurrentEnvSize > 0);
//
// environment block ends with \0\0, we don't want include the last \0 for appending
//
mszNewEnvironment.Append(pszCurrentEnvironment, dwCurrentEnvSize-1 );
dwCreationFlags = CREATE_NO_WINDOW |
CREATE_UNICODE_ENVIRONMENT |

View File

@ -1,6 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#pragma warning (disable : 4267)
#include "precomp.h"
#include "multisz.h"
#include <tchar.h>
@ -467,3 +470,5 @@ Finished:
return hr;
}
#pragma warning(default:4267)

View File

@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#pragma warning (disable : 4267)
#include "precomp.h"
#include "multisza.h"
#include <tchar.h>
@ -404,3 +405,4 @@ Finished:
return hr;
}
#pragma warning(default:4267)

View File

@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#pragma warning (disable : 4267)
#include "precomp.h"
STRU::STRU(
@ -1265,3 +1267,5 @@ Exit:
return hr;
}
#pragma warning(default:4267)