Browse Source

prevent crash upon 'reset' (MS Windows only)

h_vogt 14 years ago
parent
commit
131e40dab9
  1. 2
      ChangeLog
  2. 10
      src/xspice/mif/mifdelete.c

2
ChangeLog

@ -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:

10
src/xspice/mif/mifdelete.c

@ -48,7 +48,7 @@ NON-STANDARD FEATURES
#include "ngspice/suffix.h"
#include "ngspice/devdefs.h"
/*
MIFdelete
@ -172,6 +172,14 @@ MIFdelete(
num_inst_var = here->num_inst_var;
for(i = 0; i < num_inst_var; i++) {
if(here->inst_var[i]->element != NULL) {
/* 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]);

Loading…
Cancel
Save