From 9dcc38b566576ab209a133777fc2d92bdf33c183 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 16 Oct 2014 10:14:08 +0200 Subject: QEasingCurve: fix mem leak in operator>> The code ignored that the QEasingCurve passed in to op>> might already have a QEasingCurveFunction set, overwriting it with a new pointer without deleting the old. Change-Id: Ic14cf7e4b97c7c8c7edb64cde08fbf22c07ac8f3 Reviewed-by: Olivier Goffart --- src/corelib/tools/qeasingcurve.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 0e3375cf21..a3dd4d9a60 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -1497,6 +1497,8 @@ QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) bool hasConfig; stream >> hasConfig; + delete easing.d_ptr->config; + easing.d_ptr->config = Q_NULLPTR; if (hasConfig) { QEasingCurveFunction *config = curveToFunctionObject(type); stream >> config->_p; -- cgit v1.2.3