Fix memory leak (Coverity)

This commit is contained in:
Martin Kleusberg
2017-02-11 21:22:22 +01:00
parent 47cfd55fa6
commit 81c0cf3d4c

View File

@@ -955,9 +955,15 @@ void CreateTableWalker::parsecolumn(Table* table, antlr::RefAST c)
{
FieldVector v;
if(table->constraint(v, Constraint::PrimaryKeyConstraintType))
{
table->primaryKeyRef().push_back(f);
else
// Delete useless primary key constraint. There already is a primary key object for this table, we
// don't need another one.
delete primaryKey;
} else {
table->addConstraint({f}, ConstraintPtr(primaryKey));
}
}
}