Skip to content

Commit

Permalink
- finally found the problem with weird simulation runtime errors.
Browse files Browse the repository at this point in the history
- memset the damn malloc-ed region. 

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2929 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Sep 19, 2007
1 parent b4fdfc7 commit e89fc53
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Compiler/SimCodegen.mo
Expand Up @@ -851,6 +851,7 @@ extObjConstructorsDecl_str,
" DATA* returnData = (DATA*)malloc(sizeof(DATA));\n
if(!returnData) //error check\n
return 0;\n
memset(returnData,0,sizeof(DATA))\n;
returnData->nStates = NX;\n
returnData->nAlgebraic = NY;\n
returnData->nParameters = NP;\n
Expand Down Expand Up @@ -1028,6 +1029,7 @@ extObjConstructorsDecl_str,
printf(\"error allocating external objects\\n\");\n
exit(-2);\n
}\n",
"memset(returnData->extObjs,0,sizeof(void*)*NEXT);\n",
"setLocalData(returnData); /* must be set since used by constructors*/\n",
extObjConstructors_str,
extObjConstructorAliases_str,
Expand Down

0 comments on commit e89fc53

Please sign in to comment.