Segfault when FMDispose after FME_IMPLIED_DEFTEMPLATE_ERROR

12 views
Skip to first unread message

Ryan Johnston

unread,
Apr 14, 2023, 10:26:14 PM4/14/23
to CLIPSESG
The following code causes a segfault:

   mainEnv = CreateEnvironment();
   Fact *f = AssertString(mainEnv, "(foo)");
   FactModifier *fm = CreateFactModifier(mainEnv, f);
   FMModify(fm);
   printf("FMError: %d\n", FMError(mainEnv));
   FMDispose(fm);

CLIPS Support

unread,
Apr 15, 2023, 12:44:12 AM4/15/23
to CLIPSESG
CreateFactModifier returns a null pointer for implied deftemplate facts and sets the error to  FME_IMPLIED_DEFTEMPLATE_ERROR. Unless the documentation specifically indicates that null pointers are acceptable as parameter values, you shouldn't pass them to functions expecting a pointer to a data structure.

Ryan Johnston

unread,
Apr 15, 2023, 8:38:00 AM4/15/23
to CLIPSESG
Got it! Thank you.
Reply all
Reply to author
Forward
0 new messages