
Hi Arndt,
Arndt Jonasson wrote:
I think there is an error in the function smiFreeData in lib/data.c. For a MIB of mine, smidump had a segmentation fault there, while the memory was being freed on exit. The code is:
if (objectPtr->typePtr) { if ((objectPtr->typePtr->export.basetype == SMI_BASETYPE_OCTETSTRING || objectPtr->typePtr->export.basetype == SMI_BASETYPE_BITS)) { smiFree(objectPtr->export.value.value.ptr);
It seems to be the case that for SMI_BASETYPE_OCTETSTRING, the contents is not a pointer, but an integer, and shouldn't be freed with smiFree. Then the correct code would be:
if (objectPtr->typePtr) { if ((objectPtr->typePtr->export.basetype == SMI_BASETYPE_OCTETSTRING)) { smiFree(objectPtr->export.value.value.ptr);
In case of "BITS" (I guess you meant SMI_BASETYPE_BITS instead of SMI_BASETYPE_OCTETSTRING) the "value" may contain a DEFVAL value, which is stored in a malloc()ed storage that has to be freed. To get a better understanding of what goes wrong in your case, could you please send me your MIB (or a shrinked down MIB which still raises a segfault) in a private mail?
-frank