diff options
author | Bill King <bill.king@nokia.com> | 2009-05-20 14:48:12 +1000 |
---|---|---|
committer | Bill King <bill.king@nokia.com> | 2009-05-20 14:48:12 +1000 |
commit | ccca1883cf621eb78768962e9e6476ae0ce57a70 (patch) | |
tree | adb18794ade4db5bf4bbc5161f3b2f942008048e /src/sql/drivers/ibase/qsql_ibase.cpp | |
parent | 82a5d55502f465f17e1a6f16d9c64a19aa9dfe5e (diff) | |
download | qt4-tools-ccca1883cf621eb78768962e9e6476ae0ce57a70.tar.gz |
Fixes a memory leak in the interbase sql driver.
As suggested in gitorius merge request 421, solution supplied by Harald.
Reviewed-by: Harald Fernengel
Diffstat (limited to 'src/sql/drivers/ibase/qsql_ibase.cpp')
-rw-r--r-- | src/sql/drivers/ibase/qsql_ibase.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 4f3d79dee7..164555583f 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -55,6 +55,7 @@ #include <limits.h> #include <math.h> #include <qdebug.h> +#include <QVarLengthArray> QT_BEGIN_NAMESPACE @@ -583,7 +584,7 @@ QVariant QIBaseResultPrivate::fetchArray(int pos, ISC_QUAD *arr) int arraySize = 1, subArraySize; short dimensions = desc.array_desc_dimensions; - short *numElements = new short[dimensions]; + QVarLengthArray<short> numElements(dimensions); for(int i = 0; i < dimensions; ++i) { subArraySize = (desc.array_desc_bounds[i].array_bound_upper - @@ -612,9 +613,7 @@ QVariant QIBaseResultPrivate::fetchArray(int pos, ISC_QUAD *arr) QSqlError::StatementError)) return list; - readArrayBuffer(list, ba.data(), 0, numElements, &desc, tc); - - delete[] numElements; + readArrayBuffer(list, ba.data(), 0, numElements.data(), &desc, tc); return QVariant(list); } |