SQL/MySQL: properly initialize variable

Properly initialize outBinds - even it should be initialized by
mysql/mariadb client lib we should correctly initialize it with 0 to
avoid valgrind warnings about accessing uninitialized data.

Pick-to: 6.5 6.2 5.15
Change-Id: I85b99a7e639dad9f8d24f554cd96c5997a5838ae
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
Christian Ehrlicher 2023-04-09 21:08:44 +02:00
parent 6b67c3e738
commit ed031ed18c
1 changed files with 3 additions and 3 deletions

View File

@ -886,9 +886,9 @@ bool QMYSQLResult::prepare(const QString& query)
return false;
}
if (mysql_stmt_param_count(d->stmt) > 0) {// allocate memory for outvalues
d->outBinds = new MYSQL_BIND[mysql_stmt_param_count(d->stmt)];
}
const auto paramCount = mysql_stmt_param_count(d->stmt);
if (paramCount > 0) // allocate memory for outvalues
d->outBinds = new MYSQL_BIND[paramCount]();
setSelect(d->bindInValues());
d->preparedQuery = true;