Fix for bindvalue(int) memory allocation problem

QSqlResult::bindValue(int index, ...) is increasing the memory usage
when called multiple times for same index

Task-number: QTBUG-33169
Change-Id: I4f26125f6bb994bb430dc054df5761b6ddf03075
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
Karim Pinter 2013-08-26 11:07:15 +03:00 committed by The Qt Project
parent 2983cb9531
commit 8bdf319c28

View File

@ -688,7 +688,9 @@ void QSqlResult::bindValue(int index, const QVariant& val, QSql::ParamType param
{
Q_D(QSqlResult);
d->binds = PositionalBinding;
d->indexes[d->fieldSerial(index)].append(index);
QList<int>& indexes = d->indexes[d->fieldSerial(index)];
if (!indexes.contains(index))
indexes.append(index);
if (d->values.count() <= index)
d->values.resize(index + 1);
d->values[index] = val;