@@ -528,13 +528,13 @@ ECPGexecute(struct statement * stmt)
528
528
{
529
529
int slen = strlen ((char * )var -> value );
530
530
531
- if (!(newcopy = ecpg_alloc (slen + 1 ,stmt -> lineno )))
531
+ if (!(mallocedval = ecpg_alloc (slen + 1 ,stmt -> lineno )))
532
532
return false;
533
533
534
- strncpy (newcopy , (char * )var -> value ,slen );
535
- newcopy [slen ]= '\0' ;
534
+ strncpy (mallocedval , (char * )var -> value ,slen );
535
+ mallocedval [slen ]= '\0' ;
536
536
537
- tobeinserted = newcopy ;
537
+ tobeinserted = mallocedval ;
538
538
}
539
539
break ;
540
540
case ECPGt_varchar :
@@ -1132,13 +1132,13 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
1132
1132
con -> committed = true;
1133
1133
1134
1134
/* deallocate all prepared statements */
1135
- for (this = prep_stmts ;this != NULL ;this = this -> next )
1136
- {
1137
- bool b = ECPGdeallocate (lineno ,this -> name );
1135
+ while (prep_stmts != NULL ) {
1136
+ bool b = ECPGdeallocate (lineno ,prep_stmts -> name );
1138
1137
1139
1138
if (!b )
1140
1139
return false;
1141
1140
}
1141
+
1142
1142
}
1143
1143
1144
1144
return true;
@@ -1416,6 +1416,7 @@ ECPGdeallocate(int lineno, char *name)
1416
1416
else
1417
1417
prep_stmts = this -> next ;
1418
1418
1419
+ free (this );
1419
1420
return true;
1420
1421
}
1421
1422
ECPGlog ("deallocate_prepare: invalid statement name %s\n" ,name );