@@ -146,6 +146,8 @@ static PyObject *fkine_all(PyObject *self, PyObject *args)
146
146
}
147
147
}
148
148
149
+ free (ret );
150
+
149
151
Py_RETURN_NONE ;
150
152
}
151
153
@@ -591,6 +593,11 @@ void _jacobe(PyObject *links, int m, int n, npy_float64 *q, npy_float64 *etool,
591
593
}
592
594
}
593
595
PyList_Reverse (links );
596
+
597
+ free (T );
598
+ free (U );
599
+ free (temp );
600
+ free (ret );
594
601
}
595
602
596
603
void _jacob0 (PyObject * links , int m , int n , npy_float64 * q , npy_float64 * etool , npy_float64 * tool , npy_float64 * J )
@@ -693,6 +700,12 @@ void _jacob0(PyObject *links, int m, int n, npy_float64 *q, npy_float64 *etool,
693
700
copy (temp , U );
694
701
}
695
702
}
703
+
704
+ free (T );
705
+ free (U );
706
+ free (temp );
707
+ free (ret );
708
+ free (invU );
696
709
}
697
710
698
711
void _fkine (PyObject * links , int n , npy_float64 * q , npy_float64 * etool , npy_float64 * tool , npy_float64 * ret )
@@ -725,6 +738,9 @@ void _fkine(PyObject *links, int n, npy_float64 *q, npy_float64 *etool, npy_floa
725
738
mult (current , etool , ret );
726
739
copy (ret , current );
727
740
mult (current , tool , ret );
741
+
742
+ free (temp );
743
+ free (current );
728
744
}
729
745
730
746
void A (Link * link , npy_float64 * ret , double eta )
@@ -748,6 +764,7 @@ void A(Link *link, npy_float64 *ret, double eta)
748
764
749
765
// Multiply ret = A * v
750
766
mult (link -> A , v , ret );
767
+ free (v );
751
768
}
752
769
753
770
void copy (npy_float64 * A , npy_float64 * B )
@@ -1074,6 +1091,7 @@ int _inv(npy_float64 *m, npy_float64 *invOut)
1074
1091
for (i = 0 ; i < 16 ; i ++ )
1075
1092
invOut [i ] = inv [i ] * det ;
1076
1093
1094
+ free (inv );
1077
1095
return 1 ;
1078
1096
}
1079
1097
0 commit comments