From 52f639277b527b97eb29f3f91e0f5899fd30d8a2 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Sun, 26 Jul 2009 20:20:25 +0000 Subject: Second attempt to fix a null pointer reference in deallocators of built-in types (the first was in revision 21877). When an exception has raised within from the __init__ method of a user-defined class derived from a built-in type (e.g., UnaryPredicate0D and BinaryPredicate1D), some member variables of the base type are left uninitialized, leading to a null pointer reference in the "__dealloc__" function in the base type. To avoid this, pointer checking was added in the deallocators of those built-in types that can be used to define a subclass by a user. --- source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp | 3 ++- source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp | 3 ++- source/blender/freestyle/intern/python/BPy_Interface0D.cpp | 2 +- source/blender/freestyle/intern/python/BPy_Interface1D.cpp | 2 +- source/blender/freestyle/intern/python/BPy_Iterator.cpp | 3 ++- source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp | 2 +- source/blender/freestyle/intern/python/BPy_StrokeShader.cpp | 3 ++- source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp | 3 ++- source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp | 3 ++- .../intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp | 3 ++- .../intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp | 3 ++- .../intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp | 3 ++- .../freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp | 3 ++- .../intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp | 3 ++- .../intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp | 3 ++- .../intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp | 3 ++- .../intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp | 3 ++- .../python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp | 3 ++- .../intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp | 3 ++- .../intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp | 3 ++- .../intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp | 3 ++- .../intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp | 3 ++- .../intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp | 3 ++- .../intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp | 3 ++- .../intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp | 3 ++- .../python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp | 3 ++- .../intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp | 3 ++- 27 files changed, 51 insertions(+), 27 deletions(-) (limited to 'source/blender/freestyle/intern/python') diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp index 71504903f81..7721bc1ba0d 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp @@ -133,7 +133,8 @@ int BinaryPredicate0D___init__(BPy_BinaryPredicate0D *self, PyObject *args, PyOb void BinaryPredicate0D___dealloc__(BPy_BinaryPredicate0D* self) { - delete self->bp0D; + if (self->bp0D) + delete self->bp0D; self->ob_type->tp_free((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp index 1f601d60412..80195ed0a20 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp @@ -164,7 +164,8 @@ int BinaryPredicate1D___init__(BPy_BinaryPredicate1D *self, PyObject *args, PyOb void BinaryPredicate1D___dealloc__(BPy_BinaryPredicate1D* self) { - delete self->bp1D; + if (self->bp1D) + delete self->bp1D; self->ob_type->tp_free((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp index fb8c27c4205..11d7cec7058 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp @@ -189,7 +189,7 @@ int Interface0D___init__(BPy_Interface0D *self, PyObject *args, PyObject *kwds) void Interface0D___dealloc__(BPy_Interface0D* self) { - if( self->if0D->py_if0D ) + if( self->if0D && self->if0D->py_if0D ) delete self->if0D; self->ob_type->tp_free((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp index b6a6501c540..c6d6e75d897 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp @@ -204,7 +204,7 @@ int Interface1D___init__(BPy_Interface1D *self, PyObject *args, PyObject *kwds) void Interface1D___dealloc__(BPy_Interface1D* self) { - if( self->if1D->py_if1D ) + if( self->if1D && self->if1D->py_if1D ) delete self->if1D; self->ob_type->tp_free((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.cpp b/source/blender/freestyle/intern/python/BPy_Iterator.cpp index 5c19dfd29ac..3356325c92f 100644 --- a/source/blender/freestyle/intern/python/BPy_Iterator.cpp +++ b/source/blender/freestyle/intern/python/BPy_Iterator.cpp @@ -193,7 +193,8 @@ PyMODINIT_FUNC Iterator_Init( PyObject *module ) void Iterator___dealloc__(BPy_Iterator* self) { - delete self->it; + if (self->it) + delete self->it; self->ob_type->tp_free((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index 8f20e740580..c603acac9b4 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -208,7 +208,7 @@ int StrokeAttribute___init__(BPy_StrokeAttribute *self, PyObject *args, PyObject void StrokeAttribute___dealloc__(BPy_StrokeAttribute* self) { - if( self->sa->py_sa ) + if( self->sa && self->sa->py_sa ) delete self->sa; self->ob_type->tp_free((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp index f18620888f0..c53f1e7d888 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp @@ -266,7 +266,8 @@ int StrokeShader___init__(BPy_StrokeShader *self, PyObject *args, PyObject *kwds void StrokeShader___dealloc__(BPy_StrokeShader* self) { - delete self->ss; + if (self->ss) + delete self->ss; self->ob_type->tp_free((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp index 5f3312a1801..8dc3b12a915 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp @@ -144,7 +144,8 @@ int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args, PyObje void UnaryPredicate0D___dealloc__(BPy_UnaryPredicate0D* self) { - delete self->up0D; + if (self->up0D) + delete self->up0D; self->ob_type->tp_free((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp index 7bf4cfbbc6d..18714095ef1 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp @@ -186,7 +186,8 @@ int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args, PyObje void UnaryPredicate1D___dealloc__(BPy_UnaryPredicate1D* self) { - delete self->up1D; + if (self->up1D) + delete self->up1D; self->ob_type->tp_free((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp index cfc4bb24a56..3d0eadfa9a3 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp @@ -197,7 +197,8 @@ int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble* self) void UnaryFunction0DDouble___dealloc__(BPy_UnaryFunction0DDouble* self) { - delete self->uf0D_double; + if (self->uf0D_double) + delete self->uf0D_double; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp index ac5b1257167..543d6dc57a7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp @@ -140,7 +140,8 @@ int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature* self) void UnaryFunction0DEdgeNature___dealloc__(BPy_UnaryFunction0DEdgeNature* self) { - delete self->uf0D_edgenature; + if (self->uf0D_edgenature) + delete self->uf0D_edgenature; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp index 13285bdcf88..949a88a49af 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp @@ -169,7 +169,8 @@ int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat* self) void UnaryFunction0DFloat___dealloc__(BPy_UnaryFunction0DFloat* self) { - delete self->uf0D_float; + if (self->uf0D_float) + delete self->uf0D_float; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp index 15863eb3600..1041f1053de 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp @@ -140,7 +140,8 @@ int UnaryFunction0DId___init__(BPy_UnaryFunction0DId* self) void UnaryFunction0DId___dealloc__(BPy_UnaryFunction0DId* self) { - delete self->uf0D_id; + if (self->uf0D_id) + delete self->uf0D_id; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp index bbb7e2d61a2..64b4d53fe2e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp @@ -140,7 +140,8 @@ int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial* self) void UnaryFunction0DMaterial___dealloc__(BPy_UnaryFunction0DMaterial* self) { - delete self->uf0D_material; + if (self->uf0D_material) + delete self->uf0D_material; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index 1b8535318af..b0ecbc79cd2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -140,7 +140,8 @@ int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned* self) void UnaryFunction0DUnsigned___dealloc__(BPy_UnaryFunction0DUnsigned* self) { - delete self->uf0D_unsigned; + if (self->uf0D_unsigned) + delete self->uf0D_unsigned; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp index a2bda09180a..946210ee381 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp @@ -146,7 +146,8 @@ int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f* self) void UnaryFunction0DVec2f___dealloc__(BPy_UnaryFunction0DVec2f* self) { - delete self->uf0D_vec2f; + if (self->uf0D_vec2f) + delete self->uf0D_vec2f; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp index b484d872627..d3d0a6593ca 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp @@ -140,7 +140,8 @@ int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f* self) void UnaryFunction0DVec3f___dealloc__(BPy_UnaryFunction0DVec3f* self) { - delete self->uf0D_vec3f; + if (self->uf0D_vec3f) + delete self->uf0D_vec3f; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 9640bf23e43..de77cdd686b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -140,7 +140,8 @@ int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorViewShape* void UnaryFunction0DVectorViewShape___dealloc__(BPy_UnaryFunction0DVectorViewShape* self) { - delete self->uf0D_vectorviewshape; + if (self->uf0D_vectorviewshape) + delete self->uf0D_vectorviewshape; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp index d8be0411c9e..2fe1e61dcf3 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp @@ -146,7 +146,8 @@ int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape* self) void UnaryFunction0DViewShape___dealloc__(BPy_UnaryFunction0DViewShape* self) { - delete self->uf0D_viewshape; + if (self->uf0D_viewshape) + delete self->uf0D_viewshape; UnaryFunction0D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp index 89d79e0b83f..17949073949 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -237,7 +237,8 @@ int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble* self, PyObject *ar void UnaryFunction1DDouble___dealloc__(BPy_UnaryFunction1DDouble* self) { - delete self->uf1D_double; + if (self->uf1D_double) + delete self->uf1D_double; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp index 7723be839a4..e704eebc8be 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -157,7 +157,8 @@ int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature* self, PyOb } void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature* self) { - delete self->uf1D_edgenature; + if (self->uf1D_edgenature) + delete self->uf1D_edgenature; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp index 2a8d8f9ec75..36296554213 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -150,7 +150,8 @@ int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat* self, PyObject *args } void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat* self) { - delete self->uf1D_float; + if (self->uf1D_float) + delete self->uf1D_float; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index 44bf1c5d563..18da07c5bfb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -157,7 +157,8 @@ int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned* self, PyObject } void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned* self) { - delete self->uf1D_unsigned; + if (self->uf1D_unsigned) + delete self->uf1D_unsigned; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp index cb4698b1c50..06c17d0f635 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -163,7 +163,8 @@ int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f* self, PyObject *args } void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f* self) { - delete self->uf1D_vec2f; + if (self->uf1D_vec2f) + delete self->uf1D_vec2f; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp index 0d4ce8c6cf1..2fe32c1c311 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -157,7 +157,8 @@ int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f* self, PyObject *args } void UnaryFunction1DVec3f___dealloc__(BPy_UnaryFunction1DVec3f* self) { - delete self->uf1D_vec3f; + if (self->uf1D_vec3f) + delete self->uf1D_vec3f; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index a79b70e4593..5b86ea1f4ca 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -171,7 +171,8 @@ int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorViewShape* void UnaryFunction1DVectorViewShape___dealloc__(BPy_UnaryFunction1DVectorViewShape* self) { - delete self->uf1D_vectorviewshape; + if (self->uf1D_vectorviewshape) + delete self->uf1D_vectorviewshape; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp index 4c081b8ad64..ff588a9f3b8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -172,7 +172,8 @@ int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid* self, PyObject *args) void UnaryFunction1DVoid___dealloc__(BPy_UnaryFunction1DVoid* self) { - delete self->uf1D_void; + if (self->uf1D_void) + delete self->uf1D_void; UnaryFunction1D_Type.tp_dealloc((PyObject*)self); } -- cgit v1.2.3