summaryrefslogtreecommitdiffstats
path: root/src/sql/drivers
diff options
context:
space:
mode:
authorBill King <bill.king@nokia.com>2009-05-20 04:48:12 (GMT)
committerBill King <bill.king@nokia.com>2009-05-20 04:48:12 (GMT)
commitccca1883cf621eb78768962e9e6476ae0ce57a70 (patch)
treeadb18794ade4db5bf4bbc5161f3b2f942008048e /src/sql/drivers
parent82a5d55502f465f17e1a6f16d9c64a19aa9dfe5e (diff)
downloadQt-ccca1883cf621eb78768962e9e6476ae0ce57a70.zip
Qt-ccca1883cf621eb78768962e9e6476ae0ce57a70.tar.gz
Qt-ccca1883cf621eb78768962e9e6476ae0ce57a70.tar.bz2
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')
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp7
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 4f3d79d..1645555 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);
}