1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
$NetBSD: patch-at,v 1.1 2001/02/12 00:53:14 itojun Exp $
--- tcl/tclProc.c- Mon Feb 12 09:46:23 2001
+++ tcl/tclProc.c Mon Feb 12 09:49:35 2001
@@ -690,7 +690,7 @@
char **argv; /* Argument values. */
{
char **args;
- register Var *formalPtr, *argPtr;
+ register Var *formalPtr, *argPtr, *nextPtr;
register Interp *iPtr = (Interp *) interp;
CallFrame frame;
char *value, *end;
@@ -700,6 +700,7 @@
* Set up a call frame for the new procedure invocation.
*/
+ memset(&frame, 0, sizeof(frame));
iPtr = procPtr->iPtr;
frame.varPtr = NULL;
if (iPtr->varFramePtr != NULL) {
@@ -793,7 +794,8 @@
*/
procDone:
- for (argPtr = frame.varPtr; argPtr != NULL; argPtr = argPtr->nextPtr) {
+ for (argPtr = frame.varPtr; argPtr != NULL; argPtr = nextPtr) {
+ nextPtr = argPtr->nextPtr;
if (argPtr->flags & VAR_DYNAMIC) {
free(argPtr->value);
}
@@ -919,7 +921,7 @@
if (valueLength < 20) {
valueLength = 20;
}
- varPtr = (Var *) malloc(VAR_SIZE(nameLength, valueLength));
+ varPtr = (Var *) calloc(1, VAR_SIZE(nameLength, valueLength));
strcpy(varPtr->name, name);
varPtr->value = varPtr->name + nameLength + 1;
strcpy(varPtr->value, value);
|