diff options
author | Andrew Niefer | 2010-08-10 19:50:06 +0000 |
---|---|---|
committer | Andrew Niefer | 2010-08-10 19:50:06 +0000 |
commit | 20e164e4401299d54f10e11a0c479bb0553224fe (patch) | |
tree | 222d011e5e9067eae4597eee2b28b6d6df54caaa /bundles | |
parent | 5a8ec736bac349e5311d039b9567f95c1ea16529 (diff) | |
download | rt.equinox.framework-20e164e4401299d54f10e11a0c479bb0553224fe.tar.gz rt.equinox.framework-20e164e4401299d54f10e11a0c479bb0553224fe.tar.xz rt.equinox.framework-20e164e4401299d54f10e11a0c479bb0553224fe.zip |
bug 316975 - memory leak on failure to read .ini file
Diffstat (limited to 'bundles')
-rw-r--r-- | bundles/org.eclipse.equinox.executable/library/eclipseConfig.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseConfig.c b/bundles/org.eclipse.equinox.executable/library/eclipseConfig.c index 8212c4e78..29e7f33d3 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseConfig.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipseConfig.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Martin Oberhuber (Wind River) - [316975] memory leak on failure reading .ini file *******************************************************************************/ #include "eclipseOS.h" @@ -84,10 +85,6 @@ int readConfigFile( _TCHAR * config_file, int *argc, _TCHAR ***argv ) size_t bufferSize = 1024; size_t length; - /* allocate buffers */ - buffer = (_TCHAR*)malloc(bufferSize * sizeof(_TCHAR)); - argument = (_TCHAR*)malloc(bufferSize * sizeof(_TCHAR)); - /* Open the config file as a text file * Note that carriage return-linefeed combination \r\n are automatically * translated into single linefeeds on input in the t (translated) mode @@ -96,6 +93,10 @@ int readConfigFile( _TCHAR * config_file, int *argc, _TCHAR ***argv ) file = _tfopen(config_file, _T_ECLIPSE("rt")); if (file == NULL) return -3; + /* allocate buffers */ + buffer = (_TCHAR*)malloc(bufferSize * sizeof(_TCHAR)); + argument = (_TCHAR*)malloc(bufferSize * sizeof(_TCHAR)); + *argv = (_TCHAR **)malloc((1 + maxArgs) * sizeof(_TCHAR*)); index = 0; |