prevent crash upon 'reset' (MS Windows only)

This commit is contained in:
h_vogt 2012-01-28 10:35:04 +00:00
parent 5b1be4d32d
commit 131e40dab9
2 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,7 @@
2012-01-28 Holger Vogt
* configure.ac, compile_min.sh: prepare for release 24
* mifdelete.c: prevent crash upon 'reset', if codemodel is an array
FIXME: leads to small memory leak
2012-01-27 Holger Vogt
* NEWS, INSTALL, tests\bin\ngspice.pm, /visualc/include/ngspice/config.h:

View File

@ -48,7 +48,7 @@ NON-STANDARD FEATURES
#include "ngspice/suffix.h"
#include "ngspice/devdefs.h"
/*
MIFdelete
@ -172,7 +172,15 @@ MIFdelete(
num_inst_var = here->num_inst_var;
for(i = 0; i < num_inst_var; i++) {
if(here->inst_var[i]->element != NULL) {
FREE(here->inst_var[i]->element);
/* Do not delete inst_var[i]->element if MS Windows and is_array==1.
Memory is then allocated in the code model dll, and it cannot be
guaranteed that it can be freed safely here! A small memory leak is created.
FIXME
Finally one has to free the memory in the same module where allocated. */
#if defined(_MSC_VER) || defined(__MINGW32__)
if(!DEVices[here->MIFmodPtr->MIFmodType]->DEVpublic.inst_var[i].is_array)
#endif
FREE(here->inst_var[i]->element);
}
FREE(here->inst_var[i]);
}