>>>>> Matthew Upton writes:
Matthew> I have come across a memory leak in Tnm::mib split. This is
Matthew> the script I have used to identify it.
Matthew> while { 1 } { Tnm::mib split "ifOperStatus.1" }
Matthew> Sorry, I did not have time to look into a fix, I have just
Matthew> avoided the function for now.
This was easy to reproduce and to fix. Here is the patch:
diff -u -r1.28 tnmMibTcl.c
--- tnmMibTcl.c 1999/12/06 14:49:30 1.28
+++ tnmMibTcl.c 2000/02/03 10:25:06
@@ -1339,24 +1357,23 @@
}
if (nodePtr->macro == TNM_MIB_OBJECTTYPE) {
int i;
- TnmOid *basePtr = (TnmOid *) Tcl_Alloc(sizeof(TnmOid));
- TnmOid *instPtr = (TnmOid *) Tcl_Alloc(sizeof(TnmOid));
+ TnmOid base, inst;
- TnmOidInit(instPtr);
- TnmOidInit(basePtr);
+ TnmOidInit(&inst);
+ TnmOidInit(&base);
for (i = 0; i < TnmOidGetLength(oidPtr); i++) {
if (i < TnmOidGetLength(&nodeOid)) {
- TnmOidAppend(basePtr, TnmOidGet(oidPtr, i));
+ TnmOidAppend(&base, TnmOidGet(oidPtr, i));
} else {
- TnmOidAppend(instPtr, TnmOidGet(oidPtr, i));
+ TnmOidAppend(&inst, TnmOidGet(oidPtr, i));
}
}
Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp),
- TnmNewOidObj(basePtr));
+ TnmNewOidObj(&base));
Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp),
- TnmNewOidObj(instPtr));
- TnmOidFree(basePtr);
- TnmOidFree(instPtr);
+ TnmNewOidObj(&inst));
+ TnmOidFree(&base);
+ TnmOidFree(&inst);
}
TnmOidFree(&nodeOid);
break;
/js
-- Juergen Schoenwaelder Technical University Braunschweig <schoenw@ibr.cs.tu-bs.de> Dept. Operating Systems & Computer Networks Phone: +49 531 391 3289 Bueltenweg 74/75, 38106 Braunschweig, Germany Fax: +49 531 391 5936 <URL:http://www.ibr.cs.tu-bs.de/~schoenw/>-- !! This message is brought to you via the `tkined & scotty' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>. !! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.
This archive was generated by hypermail 2b29 : Mon Jan 08 2001 - 15:27:34 MET