@@ -528,13 +528,13 @@ ECPGexecute(struct statement * stmt)
528528{
529529int slen = strlen ((char * )var -> value );
530530
531- if (!(newcopy = ecpg_alloc (slen + 1 ,stmt -> lineno )))
531+ if (!(mallocedval = ecpg_alloc (slen + 1 ,stmt -> lineno )))
532532return false;
533533
534- strncpy (newcopy , (char * )var -> value ,slen );
535- newcopy [slen ]= '\0' ;
534+ strncpy (mallocedval , (char * )var -> value ,slen );
535+ mallocedval [slen ]= '\0' ;
536536
537- tobeinserted = newcopy ;
537+ tobeinserted = mallocedval ;
538538}
539539break ;
540540case ECPGt_varchar :
@@ -1132,13 +1132,13 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
11321132con -> committed = true;
11331133
11341134/* 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 );
11381137
11391138if (!b )
11401139return false;
11411140}
1141+
11421142}
11431143
11441144return true;
@@ -1416,6 +1416,7 @@ ECPGdeallocate(int lineno, char *name)
14161416else
14171417prep_stmts = this -> next ;
14181418
1419+ free (this );
14191420return true;
14201421}
14211422ECPGlog ("deallocate_prepare: invalid statement name %s\n" ,name );