[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:56:15 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 8fe839f53485ec695aef7eee1693c16bb22f5855
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Feb 26 02:04:24 2002 +0000
Top level:
* Tests/qt/qstringlist-test.cpp: (main): Clean up a problem that
was causing a bogus test failure.
WebCore:
Fix two significant memory leaks in QList found by our automated
leak-checking code.
* src/kwq/KWQListImpl.mm: (KWQListNode::~KWQListNode),
(KWQListImpl::KWQListPrivate::copyList),
(KWQListImpl::KWQListPrivate::~KWQListPrivate), (KWQListImpl::sort):
Fix a tiny bug tweaked by the new regexp code - we need to flush
the cache after calling out to QRegExp::match because it might
make calls on the string which create a cache. Caught by the
regression tests.
* src/kwq/KWQString.mm: (QString::replace):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/kwq/KWQListImpl.mm b/WebCore/kwq/KWQListImpl.mm
index af65c29..4eecee2 100644
--- a/WebCore/kwq/KWQListImpl.mm
+++ b/WebCore/kwq/KWQListImpl.mm
@@ -43,6 +43,7 @@ class KWQListNode
{
public:
KWQListNode() : data(NULL), next(NULL), prev(NULL) {}
+ ~KWQListNode();
void *data;
KWQListNode *next;
@@ -50,6 +51,13 @@ public:
};
+KWQListNode::~KWQListNode()
+{
+ if (next != NULL) {
+ delete next;
+ }
+}
+
// KWQListImpl::KWQListPrivate
class KWQListImpl::KWQListPrivate
@@ -72,7 +80,7 @@ public:
KWQListNode *KWQListImpl::KWQListPrivate::copyList(KWQListNode *l)
{
KWQListNode *node = l;
- KWQListNode *head = NULL;
+ KWQListNode *copyHead = NULL;
KWQListNode *last = NULL;
while (node != NULL) {
@@ -80,18 +88,18 @@ KWQListNode *KWQListImpl::KWQListPrivate::copyList(KWQListNode *l)
copy->data = node->data;
if (last != NULL) {
last->next = copy;
- copy->prev = last;
} else {
- head = copy;
- copy->prev = NULL;
+ copyHead = copy;
}
+
+ copy->prev = last;
copy->next = NULL;
last = copy;
node = node->next;
}
- return head;
+ return copyHead;
}
KWQListImpl::KWQListPrivate::KWQListPrivate(void (*deleteFunc)(void *)) :
@@ -114,11 +122,7 @@ KWQListImpl::KWQListPrivate::KWQListPrivate(KWQListPrivate &vp) :
KWQListImpl::KWQListPrivate::~KWQListPrivate()
{
- while (head != NULL) {
- KWQListNode *tmp = head->next;
- delete head;
- head = tmp;
- }
+ delete head;
}
// KWQListIteratorImpl::KWQListIteratorPrivate
@@ -206,6 +210,8 @@ void KWQListImpl::sort(int (*compareFunc)(void *a, void *b, void *data), void *d
node->data = (void *)CFArrayGetValueAtIndex(array, i);
i++;
}
+
+ CFRelease(array);
}
void *KWQListImpl::at(uint n)
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index 05ba4a1..b542e35 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -1152,12 +1152,12 @@ QString &QString::remove(uint index, uint width)
QString &QString::replace(const QRegExp &qre, const QString &qs)
{
- flushCache();
if (s) {
int len = qs.length();
for (int i = 0; i < CFStringGetLength(s); i += len) {
int width = 0;
i = qre.match(*this, i, &width, FALSE);
+ flushCache();
if ((i < 0) || !width) {
break;
}
diff --git a/WebCore/src/kwq/KWQListImpl.mm b/WebCore/src/kwq/KWQListImpl.mm
index af65c29..4eecee2 100644
--- a/WebCore/src/kwq/KWQListImpl.mm
+++ b/WebCore/src/kwq/KWQListImpl.mm
@@ -43,6 +43,7 @@ class KWQListNode
{
public:
KWQListNode() : data(NULL), next(NULL), prev(NULL) {}
+ ~KWQListNode();
void *data;
KWQListNode *next;
@@ -50,6 +51,13 @@ public:
};
+KWQListNode::~KWQListNode()
+{
+ if (next != NULL) {
+ delete next;
+ }
+}
+
// KWQListImpl::KWQListPrivate
class KWQListImpl::KWQListPrivate
@@ -72,7 +80,7 @@ public:
KWQListNode *KWQListImpl::KWQListPrivate::copyList(KWQListNode *l)
{
KWQListNode *node = l;
- KWQListNode *head = NULL;
+ KWQListNode *copyHead = NULL;
KWQListNode *last = NULL;
while (node != NULL) {
@@ -80,18 +88,18 @@ KWQListNode *KWQListImpl::KWQListPrivate::copyList(KWQListNode *l)
copy->data = node->data;
if (last != NULL) {
last->next = copy;
- copy->prev = last;
} else {
- head = copy;
- copy->prev = NULL;
+ copyHead = copy;
}
+
+ copy->prev = last;
copy->next = NULL;
last = copy;
node = node->next;
}
- return head;
+ return copyHead;
}
KWQListImpl::KWQListPrivate::KWQListPrivate(void (*deleteFunc)(void *)) :
@@ -114,11 +122,7 @@ KWQListImpl::KWQListPrivate::KWQListPrivate(KWQListPrivate &vp) :
KWQListImpl::KWQListPrivate::~KWQListPrivate()
{
- while (head != NULL) {
- KWQListNode *tmp = head->next;
- delete head;
- head = tmp;
- }
+ delete head;
}
// KWQListIteratorImpl::KWQListIteratorPrivate
@@ -206,6 +210,8 @@ void KWQListImpl::sort(int (*compareFunc)(void *a, void *b, void *data), void *d
node->data = (void *)CFArrayGetValueAtIndex(array, i);
i++;
}
+
+ CFRelease(array);
}
void *KWQListImpl::at(uint n)
diff --git a/WebCore/src/kwq/KWQString.mm b/WebCore/src/kwq/KWQString.mm
index 05ba4a1..b542e35 100644
--- a/WebCore/src/kwq/KWQString.mm
+++ b/WebCore/src/kwq/KWQString.mm
@@ -1152,12 +1152,12 @@ QString &QString::remove(uint index, uint width)
QString &QString::replace(const QRegExp &qre, const QString &qs)
{
- flushCache();
if (s) {
int len = qs.length();
for (int i = 0; i < CFStringGetLength(s); i += len) {
int width = 0;
i = qre.match(*this, i, &width, FALSE);
+ flushCache();
if ((i < 0) || !width) {
break;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list