summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@digia.com>2012-03-12 13:53:06 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-03-14 14:06:29 (GMT)
commitd15f4b53d0d52a94b3c44b927816967a151f7ccf (patch)
tree7f89734b68b009fbdcc59b25601aff21550621e4 /src/corelib
parent827e5c4c689d4ecb4f8c1ab48c9a7ab712fe2ca7 (diff)
downloadQt-d15f4b53d0d52a94b3c44b927816967a151f7ccf.zip
Qt-d15f4b53d0d52a94b3c44b927816967a151f7ccf.tar.gz
Qt-d15f4b53d0d52a94b3c44b927816967a151f7ccf.tar.bz2
Fix q_atomic_decrement for 64-bit Solaris
q_atomic_decrement and q_atomic_increment did not set return value correctly. They expected the %eax return value register to be empty, when it was not necessarily so. This could occur when when compiler inlined e.g., ~QByteArray -> QBasicAtomicInt::deref -> q_atomic_decrement chain to application code. Data would not to be freed and leak memory. Fixed so that %eax is now zero'd before setting return value. Task-number: QTBUG-24470 Change-Id: I83495e3ddb938713863a7b00714215c331b9562b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/arch/x86_64/qatomic_sun.s2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/arch/x86_64/qatomic_sun.s b/src/corelib/arch/x86_64/qatomic_sun.s
index 37969e6..b7ce769 100644
--- a/src/corelib/arch/x86_64/qatomic_sun.s
+++ b/src/corelib/arch/x86_64/qatomic_sun.s
@@ -7,6 +7,7 @@
q_atomic_increment:
lock
incl (%rdi)
+ movl $0,%eax
setne %al
ret
.size q_atomic_increment,.-q_atomic_increment
@@ -18,6 +19,7 @@ q_atomic_increment:
q_atomic_decrement:
lock
decl (%rdi)
+ movl $0,%eax
setne %al
ret
.size q_atomic_decrement,.-q_atomic_decrement