Fixed memory leak in assign operator of QGLBuffer
authorVadim Zakondyrin <thekondr@crystalnix.com>
Sat, 17 Nov 2012 03:39:14 +0000 (10:39 +0700)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 19 Nov 2012 22:21:13 +0000 (23:21 +0100)
Change-Id: Icb51dd5a567483b415ab0e8af9eb62221225890d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/opengl/qglbuffer.cpp

index 5e503d9..acb13d6 100644 (file)
@@ -211,8 +211,10 @@ QGLBuffer &QGLBuffer::operator=(const QGLBuffer &other)
 {
     if (d_ptr != other.d_ptr) {
         other.d_ptr->ref.ref();
-        if (!d_ptr->ref.deref())
+        if (!d_ptr->ref.deref()) {
             destroy();
+            delete d_ptr;
+        }
         d_ptr = other.d_ptr;
     }
     return *this;