Skip to content

Commit

Permalink
Fix memory leak (Coverity)
Browse files Browse the repository at this point in the history
  • Loading branch information
MKleusberg committed Feb 11, 2017
1 parent 47cfd55 commit 81c0cf3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/sqlitetypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}

Expand Down

0 comments on commit 81c0cf3

Please sign in to comment.