fix memleak in BGE py api - action.channelNames
authorCampbell Barton <ideasman42@gmail.com>
Sat, 25 Jul 2009 20:51:45 +0000 (20:51 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 25 Jul 2009 20:51:45 +0000 (20:51 +0000)
source/gameengine/Converter/BL_ActionActuator.cpp

index 2df33f6ed4de7c1c238c7f91fd569ede15035fa4..88d6d294dc08e126d70c24c4177bde724466197c 100644 (file)
@@ -1106,13 +1106,16 @@ PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA
 {
        BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
        PyObject *ret= PyList_New(0);
 {
        BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
        PyObject *ret= PyList_New(0);
+       PyObject *item;
        
        bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose();
        
        if(pose) {
                bPoseChannel *pchan;
                for(pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
        
        bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose();
        
        if(pose) {
                bPoseChannel *pchan;
                for(pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
-                       PyList_Append(ret, PyString_FromString(pchan->name));
+                       item= PyString_FromString(pchan->name);
+                       PyList_Append(ret, item);
+                       Py_DECREF(item);
                }
        }
        
                }
        }