openbsd-ports/net/icb/patches/patch-aj
wilfried 11f08e1166 respect CFLAGS
fix memory bugs while I'm at it
2001-03-12 15:59:02 +00:00

55 lines
1.6 KiB
Plaintext

--- tcl/tclProc.c.orig Fri Feb 24 22:19:56 1995
+++ tcl/tclProc.c Sun Feb 11 12:27:12 2001
@@ -124,8 +124,8 @@
argPtr = (Var *) malloc(VAR_SIZE(nameLength, valueLength));
procPtr->argPtr = argPtr;
} else {
- argPtr->nextPtr = (Var *) malloc(VAR_SIZE(nameLength, valueLength));
- argPtr = argPtr->nextPtr;
+ procPtr->argPtr->nextPtr = (Var *) malloc(VAR_SIZE(nameLength, valueLength));
+ argPtr = procPtr->argPtr->nextPtr;
}
strcpy(argPtr->name, fieldValues[0]);
if (fieldCount == 2) {
@@ -136,6 +136,7 @@
}
argPtr->valueLength = valueLength;
argPtr->flags = 0;
+ argPtr->globalPtr = NULL;
argPtr->nextPtr = NULL;
free((char *) fieldValues);
}
@@ -793,11 +794,13 @@
*/
procDone:
- for (argPtr = frame.varPtr; argPtr != NULL; argPtr = argPtr->nextPtr) {
+ for (argPtr = frame.varPtr; argPtr != NULL;) {
+ void *tmp = argPtr;
if (argPtr->flags & VAR_DYNAMIC) {
free(argPtr->value);
}
- free((char *) argPtr);
+ argPtr = argPtr->nextPtr;
+ free(tmp);
}
iPtr->framePtr = frame.callerPtr;
iPtr->varFramePtr = frame.callerVarPtr;
@@ -826,13 +829,14 @@
ProcDeleteProc(procPtr)
register Proc *procPtr; /* Procedure to be deleted. */
{
- register Var *argPtr;
+ register Var *argPtr, *arg1Ptr;
free((char *) procPtr->command);
- for (argPtr = procPtr->argPtr; argPtr != NULL; argPtr = argPtr->nextPtr) {
+ for (argPtr = procPtr->argPtr; argPtr != NULL; argPtr = arg1Ptr) {
if (argPtr->flags & VAR_DYNAMIC) {
free(argPtr->value);
}
+ arg1Ptr = argPtr->nextPtr;
free((char *) argPtr);
}
free((char *) procPtr);