{
int slen = strlen((char *) var->value);
- if (!(newcopy = ecpg_alloc(slen + 1, stmt->lineno)))
+ if (!(mallocedval = ecpg_alloc(slen + 1, stmt->lineno)))
return false;
- strncpy(newcopy, (char *) var->value, slen);
- newcopy[slen] = '\0';
+ strncpy(mallocedval, (char *) var->value, slen);
+ mallocedval[slen] = '\0';
- tobeinserted = newcopy;
+ tobeinserted = mallocedval;
}
break;
case ECPGt_varchar:
con->committed = true;
/* deallocate all prepared statements */
- for (this = prep_stmts; this != NULL; this = this->next)
- {
- bool b = ECPGdeallocate(lineno, this->name);
+ while(prep_stmts != NULL) {
+ bool b = ECPGdeallocate(lineno, prep_stmts->name);
if (!b)
return false;
}
+
}
return true;
else
prep_stmts = this->next;
+ free(this);
return true;
}
ECPGlog("deallocate_prepare: invalid statement name %s\n", name);