Skip to content

Commit

Permalink
- Don't let the CORBA implementation free() tempDirectoryPath
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8031 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Feb 26, 2011
1 parent 9cd8362 commit 4326056
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Compiler/runtime/Settings_omc.cpp
Expand Up @@ -76,7 +76,7 @@ extern const char* Settings_getVersionNr()

extern const char* Settings_getTempDirectoryPath()
{
return strdup(SettingsImpl__getTempDirectoryPath());
return SettingsImpl__getTempDirectoryPath();
}

}
12 changes: 6 additions & 6 deletions Compiler/runtime/Settings_rml.c
Expand Up @@ -96,9 +96,9 @@ RML_END_LABEL

RML_BEGIN_LABEL(Settings__getTempDirectoryPath)
{
SettingsImpl__getTempDirectoryPath();
if (tempDirectoryPath)
rmlA0 = (void*) mk_scon(strdup(tempDirectoryPath));
const char *tdp = SettingsImpl__getTempDirectoryPath();
if (tdp)
rmlA0 = (void*) mk_scon(tdp);
else
rmlA0 = (void*) mk_scon("");
RML_TAILCALLK(rmlSC);
Expand Down Expand Up @@ -164,15 +164,15 @@ RML_END_LABEL

RML_BEGIN_LABEL(Settings__dumpSettings)
{
const char *str;
if(compileCommand)
printf("compile command: %s\n",compileCommand);

if(compilePath)
printf("Compiler path: %s\n",compilePath);


if(tempDirectoryPath)
printf("temp directory path: %s\n",tempDirectoryPath);
if(0 != (str = SettingsImpl__getTempDirectoryPath()))
printf("temp directory path: %s\n",str);

RML_TAILCALLK(rmlSC);
}
Expand Down
3 changes: 1 addition & 2 deletions Compiler/runtime/corbaimpl.cpp
Expand Up @@ -311,7 +311,7 @@ int CorbaImpl__initialize()
mgr = poa->the_POAManager();

/* get temp dir */
char* tmpDir = SettingsImpl__getTempDirectoryPath();
const char* tmpDir = SettingsImpl__getTempDirectoryPath();
/* get the user name */
char *user = getenv("USER");
if (user==NULL) { user="nobody"; }
Expand Down Expand Up @@ -347,7 +347,6 @@ int CorbaImpl__initialize()
ref = poa->id_to_reference (oid.in());
objref_file << tmpDir << "/openmodelica." << user << ".objid";
}
free(tmpDir);

str = orb->object_to_string (ref.in());
/* Write reference to file */
Expand Down
4 changes: 2 additions & 2 deletions Compiler/runtime/settingsimpl.c
Expand Up @@ -163,7 +163,7 @@ extern void SettingsImpl__setTempDirectoryPath(const char *path)
tempDirectoryPath = strdup(path);
}

extern char* SettingsImpl__getTempDirectoryPath()
extern const char* SettingsImpl__getTempDirectoryPath()
{
if (tempDirectoryPath == NULL) {
// On windows, set Temp directory path to Temp directory as returned by GetTempPath,
Expand All @@ -186,7 +186,7 @@ extern char* SettingsImpl__getTempDirectoryPath()
#else
const char* str = getenv("TMPDIR");
if (str == NULL)
str = "/tmp";
str = strdup("/tmp");
tempDirectoryPath = strdup(str);
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion Compiler/runtime/settingsimpl.h
Expand Up @@ -30,5 +30,5 @@

#ifndef SETTINGSIMPL__H_
#define SETTINGSIMPL__H_
extern char* SettingsImpl__getTempDirectoryPath();
extern const char* SettingsImpl__getTempDirectoryPath();
#endif

0 comments on commit 4326056

Please sign in to comment.