Can you please help us with below coverity issue?
File: factmngr.c
Method: ReturnFact
Category: Use After Free
This could cause an immediate crash or incorrect values might be read subsequently resulting in incorrect computations.
In ReturnFact(void *, fact *): A pointer to freed memory is dereferenced, used as a function argument, or otherwise used (CWE-416)
Call stack:
...
8. Condition theFact->theProposition.multifieldLength == 0, taking false branch.
if (theFact->theProposition.multifieldLength == 0) newSize = 1;
else newSize = theFact->theProposition.multifieldLength;
9. Condition ((memoryData *)((environmentData *)theEnv)->theData[59])->TempSize2 < 500UL /* (unsigned long)500 */, taking false branch.
10. freed_arg: rm3 frees theFact. [show details]
CID XXXXX (#1 of 1): Use after free (USE_AFTER_FREE)
11. use_after_free: Using freed pointer theFact.
rtn_var_struct2(theEnv,fact,sizeof(struct field) * (newSize - 1),theFact);
}
Appreciate your inputs on this.
Thanks,
Prasad