
Hi!
Steve> I'm using libsmi-0.3.1. There is a memory leak in the Steve> following code use of libsmi. The call to smiGetParentNode() Steve> does a addObject("<implicit>"...) and it allocates two objects Steve> Object and Node, but because this node has no parent addNode() Steve> doesn't assign the new node to anything. I found this because Steve> I have some code that travels up the parent nodes of a oid.
Steve> pNode = smiGetNode( NULL, "1" ); Steve> SmiNode* pNode2 = smiGetParentNode( pNode );
Thanks, Steve. I've just changed this implicit Object allocation, so that it only happens in cases where there really is a yet unnamed parent node (and not for attempt to smiGetParentNode() for top-level nodes):
if ((!objectPtr) && (nodePtr->parentPtr)) { /* an implicitly created node, e.g. gaga.0 in an object * definition with oid == gaga.0.1. */ objectPtr = addObject(SMI_UNKNOWN_LABEL, nodePtr->parentPtr, nodePtr->subid, 0, NULL); objectPtr->nodePtr = nodePtr; objectPtr->modulePtr = modulePtr; }
-frank