diff options
author | Martin Poirier <theeth@yahoo.com> | 2007-05-21 23:42:11 +0400 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2007-05-21 23:42:11 +0400 |
commit | c4f6ac80df03aa236f8dbfe7dc92f6e06121cceb (patch) | |
tree | 4fb4a8c79ff85f21a3d894b9be122a4622a4f3f6 /source/blender | |
parent | 21bc08a0bb39638e13fa19109a22e2d9fb20579e (diff) |
=== Bugfix ===
Coverity bugfix (missing NULL check) and ref counting errors. (on module constants, so not really leaking, just not good.)
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/api2_2x/Armature.c | 24 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Pose.c | 6 | ||||
-rw-r--r-- | source/blender/python/api2_2x/constant.c | 24 |
3 files changed, 30 insertions, 24 deletions
diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c index d4d687f7306..98b64d7554c 100644 --- a/source/blender/python/api2_2x/Armature.c +++ b/source/blender/python/api2_2x/Armature.c @@ -1373,30 +1373,30 @@ PyObject *Armature_Init(void) //Add CONSTANTS to the module PyModule_AddObject(module, "CONNECTED", - EXPP_incr_ret(PyConstant_NewInt("CONNECTED", BONE_CONNECTED))); + PyConstant_NewInt("CONNECTED", BONE_CONNECTED)); PyModule_AddObject(module, "HINGE", - EXPP_incr_ret(PyConstant_NewInt("HINGE", BONE_HINGE))); + PyConstant_NewInt("HINGE", BONE_HINGE)); PyModule_AddObject(module, "NO_DEFORM", - EXPP_incr_ret(PyConstant_NewInt("NO_DEFORM", BONE_NO_DEFORM))); + PyConstant_NewInt("NO_DEFORM", BONE_NO_DEFORM)); PyModule_AddObject(module, "MULTIPLY", - EXPP_incr_ret(PyConstant_NewInt("MULTIPLY", BONE_MULT_VG_ENV))); + PyConstant_NewInt("MULTIPLY", BONE_MULT_VG_ENV)); PyModule_AddObject(module, "HIDDEN_EDIT", - EXPP_incr_ret(PyConstant_NewInt("HIDDEN_EDIT", BONE_HIDDEN_A))); + PyConstant_NewInt("HIDDEN_EDIT", BONE_HIDDEN_A)); PyModule_AddObject(module, "ROOT_SELECTED", - EXPP_incr_ret(PyConstant_NewInt("ROOT_SELECTED", BONE_ROOTSEL))); + PyConstant_NewInt("ROOT_SELECTED", BONE_ROOTSEL)); PyModule_AddObject(module, "BONE_SELECTED", - EXPP_incr_ret(PyConstant_NewInt("BONE_SELECTED", BONE_SELECTED))); + PyConstant_NewInt("BONE_SELECTED", BONE_SELECTED)); PyModule_AddObject(module, "TIP_SELECTED", - EXPP_incr_ret(PyConstant_NewInt("TIP_SELECTED", BONE_TIPSEL))); + PyConstant_NewInt("TIP_SELECTED", BONE_TIPSEL)); PyModule_AddObject(module, "OCTAHEDRON", - EXPP_incr_ret(PyConstant_NewInt("OCTAHEDRON", ARM_OCTA))); + PyConstant_NewInt("OCTAHEDRON", ARM_OCTA)); PyModule_AddObject(module, "STICK", - EXPP_incr_ret(PyConstant_NewInt("STICK", ARM_LINE))); + PyConstant_NewInt("STICK", ARM_LINE)); PyModule_AddObject(module, "BBONE", - EXPP_incr_ret(PyConstant_NewInt("BBONE", ARM_B_BONE))); + PyConstant_NewInt("BBONE", ARM_B_BONE)); PyModule_AddObject(module, "ENVELOPE", - EXPP_incr_ret(PyConstant_NewInt("ENVELOPE", ARM_ENVELOPE))); + PyConstant_NewInt("ENVELOPE", ARM_ENVELOPE)); //Add SUBMODULES to the module dict = PyModule_GetDict( module ); //borrowed diff --git a/source/blender/python/api2_2x/Pose.c b/source/blender/python/api2_2x/Pose.c index 2b4f67c9b8c..fe60b04b5ff 100644 --- a/source/blender/python/api2_2x/Pose.c +++ b/source/blender/python/api2_2x/Pose.c @@ -1236,11 +1236,11 @@ PyObject *Pose_Init(void) //Add CONSTANTS to the module PyModule_AddObject(module, "ROT", - EXPP_incr_ret(PyConstant_NewInt("ROT", POSE_ROT))); + PyConstant_NewInt("ROT", POSE_ROT)); PyModule_AddObject(module, "LOC", - EXPP_incr_ret(PyConstant_NewInt("LOC", POSE_LOC))); + PyConstant_NewInt("LOC", POSE_LOC)); PyModule_AddObject(module, "SIZE", - EXPP_incr_ret(PyConstant_NewInt("SIZE", POSE_SIZE))); + PyConstant_NewInt("SIZE", POSE_SIZE)); return module; } diff --git a/source/blender/python/api2_2x/constant.c b/source/blender/python/api2_2x/constant.c index 0162ad99b6c..2f74007f617 100644 --- a/source/blender/python/api2_2x/constant.c +++ b/source/blender/python/api2_2x/constant.c @@ -245,17 +245,23 @@ int PyConstant_Insert(BPy_constant *self, char *name, PyObject *value) PyObject *PyConstant_NewInt(char *name, int value) { PyObject *constant = PyConstant_New(); - - PyConstant_Insert((BPy_constant*)constant, "name", PyString_FromString(name)); - PyConstant_Insert((BPy_constant*)constant, "value", PyInt_FromLong(value)); - return EXPP_incr_ret(constant); + + if (constant) + { + PyConstant_Insert((BPy_constant*)constant, "name", PyString_FromString(name)); + PyConstant_Insert((BPy_constant*)constant, "value", PyInt_FromLong(value)); + } + return constant; } //This is a helper function for generating constants...... PyObject *PyConstant_NewString(char *name, char *value) { - PyObject *constant = PyConstant_New(); - - PyConstant_Insert((BPy_constant*)constant, "name", PyString_FromString(name)); - PyConstant_Insert((BPy_constant*)constant, "value", PyString_FromString(value)); - return EXPP_incr_ret(constant); + PyObject *constant = PyConstant_New(); + + if (constant) + { + PyConstant_Insert((BPy_constant*)constant, "name", PyString_FromString(name)); + PyConstant_Insert((BPy_constant*)constant, "value", PyString_FromString(value)); + } + return constant; } |