[Bf-blender-cvs] [6095c9d] blender-v2.72-release: Freestyle: Fix for memory leaks in StrokeVertexIterator.

Tamito Kajiyama noreply at git.blender.org
Wed Oct 15 13:08:21 CEST 2014


Commit: 6095c9db9fade934ba40558f5177a4f5752aabd5
Author: Tamito Kajiyama
Date:   Fri Oct 10 18:49:32 2014 +0900
Branches: blender-v2.72-release
https://developer.blender.org/rB6095c9db9fade934ba40558f5177a4f5752aabd5

Freestyle: Fix for memory leaks in StrokeVertexIterator.

The issues identified here are regression from 2.71, so the present code
revision is appropriate for backporting if 2.72a is planned.

===================================================================

M	source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp

===================================================================

diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
index 275bfe9..e35076e 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
@@ -155,9 +155,9 @@ static PyObject *StrokeVertexIterator_incremented(BPy_StrokeVertexIterator *self
 		PyErr_SetString(PyExc_RuntimeError, "cannot increment any more");
 		return NULL;
 	}
-	StrokeInternal::StrokeVertexIterator *copy = new StrokeInternal::StrokeVertexIterator(*self->sv_it);
-	copy->increment();
-	return BPy_StrokeVertexIterator_from_StrokeVertexIterator(*copy, self->reversed);
+	StrokeInternal::StrokeVertexIterator copy(*self->sv_it);
+	copy.increment();
+	return BPy_StrokeVertexIterator_from_StrokeVertexIterator(copy, self->reversed);
 }
 
 PyDoc_STRVAR(StrokeVertexIterator_decremented_doc,
@@ -174,10 +174,9 @@ static PyObject *StrokeVertexIterator_decremented(BPy_StrokeVertexIterator *self
 		PyErr_SetString(PyExc_RuntimeError, "cannot decrement any more");
 		return NULL;
 	}
-
-	StrokeInternal::StrokeVertexIterator *copy = new StrokeInternal::StrokeVertexIterator(*self->sv_it);
-	copy->decrement();
-	return BPy_StrokeVertexIterator_from_StrokeVertexIterator(*copy, self->reversed);
+	StrokeInternal::StrokeVertexIterator copy(*self->sv_it);
+	copy.decrement();
+	return BPy_StrokeVertexIterator_from_StrokeVertexIterator(copy, self->reversed);
 }
 
 PyDoc_STRVAR(StrokeVertexIterator_reversed_doc,
@@ -191,8 +190,7 @@ PyDoc_STRVAR(StrokeVertexIterator_reversed_doc,
 
 static PyObject *StrokeVertexIterator_reversed(BPy_StrokeVertexIterator *self)
 {
-	StrokeInternal::StrokeVertexIterator *copy = new StrokeInternal::StrokeVertexIterator(*self->sv_it);
-	return BPy_StrokeVertexIterator_from_StrokeVertexIterator(*copy, !self->reversed);
+	return BPy_StrokeVertexIterator_from_StrokeVertexIterator(*self->sv_it, !self->reversed);
 }
 
 static PyMethodDef BPy_StrokeVertexIterator_methods[] = {




More information about the Bf-blender-cvs mailing list