summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2011-05-02 13:46:40 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2011-05-10 12:54:55 +0200
commite6e6e4c1695822776957af66413450aaccc0ff65 (patch)
treee9f00a9ef271890c0adf931ea639aa107db28ce4 /src
parentbc88f528dcfe3b2b2369530d76fee2994c2887f9 (diff)
Don't realloc user-provided buffer
When QTextBoundaryFinder doesn't own the buffer, don't realloc it and get a new one instead. Reviewed-by: Ritt Konstantin (cherry picked from commit 320f172c851a4720299297c8b3b757eb1202c568)
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qtextboundaryfinder.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp
index 34bc406309..47319d4ff4 100644
--- a/src/corelib/tools/qtextboundaryfinder.cpp
+++ b/src/corelib/tools/qtextboundaryfinder.cpp
@@ -199,11 +199,11 @@ QTextBoundaryFinder &QTextBoundaryFinder::operator=(const QTextBoundaryFinder &o
chars = other.chars;
length = other.length;
pos = other.pos;
- freePrivate = true;
QTextBoundaryFinderPrivate *newD = (QTextBoundaryFinderPrivate *)
- realloc(d, length*sizeof(HB_CharAttributes));
+ realloc(freePrivate ? d : 0, length*sizeof(HB_CharAttributes));
Q_CHECK_PTR(newD);
+ freePrivate = true;
d = newD;
memcpy(d, other.d, length*sizeof(HB_CharAttributes));