Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2004-07-20 16:30:52 -0400
committerAlain Magloire2004-07-20 16:30:52 -0400
commit243857d6effdc72517c52db2769fe9925e7a8358 (patch)
treed3ab3ea4eafc9527ca415a062ce9778d596370e6 /core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
parent58562529e5149f91551ff41e04af64d5b146cba4 (diff)
downloadorg.eclipse.cdt-243857d6effdc72517c52db2769fe9925e7a8358.tar.gz
org.eclipse.cdt-243857d6effdc72517c52db2769fe9925e7a8358.tar.xz
org.eclipse.cdt-243857d6effdc72517c52db2769fe9925e7a8358.zip
2004-07-20 Alain Magloire
Fix for PR 70359 Binaries regenerated * library/Win32ProcessEx.c * library/starter/starter.cpp * os/win32/x86/spawner.dll * os/win32/x86/starter.dll
Diffstat (limited to 'core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c')
-rw-r--r--core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c b/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
index d69f02230bd..3971fd2dd9a 100644
--- a/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
+++ b/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
@@ -108,7 +108,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
int ret = 0;
_TCHAR szCmdLine[MAX_CMD_SIZE];
int nBlkSize = MAX_ENV_SIZE;
- _TCHAR * szEnvBlock = (_TCHAR *)malloc(nBlkSize * sizeof(_TCHAR));
+ _TCHAR * szEnvBlock = NULL;
jsize nCmdTokens = 0;
jsize nEnvVars = 0;
int i;
@@ -220,10 +220,16 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
szCmdLine[nPos] = _T('\0');
+
+#ifdef DEBUG_MONITOR
+ _stprintf(buffer, _T("There are %i environment variables \n"), nEnvVars);
+ OutputDebugStringW(buffer);
+#endif
// Prepare environment block
if (nEnvVars > 0)
{
nPos = 0;
+ szEnvBlock = (_TCHAR *)malloc(nBlkSize * sizeof(_TCHAR));
for(i = 0; i < nEnvVars; ++i)
{
jobject item = (*env) -> GetObjectArrayElement(env, envp, i);
@@ -298,7 +304,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
0, /* thread security attribute */
FALSE, /* inherits system handles */
flags, /* normal attached process */
- envBlk, /* environment block */
+ szEnvBlock, /* environment block */
cwd, /* change to the new current directory */
&si, /* (in) startup information */
&pi); /* (out) process information */
@@ -307,8 +313,9 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
if(NULL != cwd)
free((void *)cwd);
-
- free(szEnvBlock);
+
+ if(NULL != szEnvBlock)
+ free(szEnvBlock);
if (!ret) // Launching error
{
@@ -411,7 +418,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
int nPos;
_TCHAR szCmdLine[MAX_CMD_SIZE];
int nBlkSize = MAX_ENV_SIZE;
- _TCHAR * szEnvBlock = (_TCHAR *)malloc(nBlkSize * sizeof(_TCHAR));
+ _TCHAR * szEnvBlock = NULL;
sa.nLength = sizeof(sa);
@@ -450,6 +457,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
// Prepare environment block
if (nEnvVars > 0)
{
+ szEnvBlock = (_TCHAR *)malloc(nBlkSize * sizeof(_TCHAR));
nPos = 0;
for(i = 0; i < nEnvVars; ++i)
{
@@ -516,7 +524,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
if(NULL != cwd)
free(cwd);
- free(szEnvBlock);
+ if(NULL != szEnvBlock)
+ free(szEnvBlock);
if (!ret) // error
{

Back to the top