Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-07-03 04:02:45 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-07-03 04:02:45 +0400
commit98a7ca61fa905792bd3fdfa6c29f44691c9582ac (patch)
tree47455f2482f6eca0352c10c57482641eec6afb57 /source/blender/python/mathutils/mathutils.c
parent4e39a854b4589cddff484649d95cce4c71d4e9f4 (diff)
parent2ed69a95f499081aacc15c0295f3461c38430554 (diff)
Merged changes in the trunk up to revision 48505.
Diffstat (limited to 'source/blender/python/mathutils/mathutils.c')
-rw-r--r--source/blender/python/mathutils/mathutils.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index 8b79301f264..c08165f9850 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -133,6 +133,7 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *
}
}
+/* on error, -1 is returned and no allocation is made */
int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, const char *error_prefix)
{
int size;
@@ -164,6 +165,7 @@ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, c
{
PyObject *value_fast = NULL;
// *array = NULL;
+ int ret;
/* non list/tuple cases */
if (!(value_fast = PySequence_Fast(value, error_prefix))) {
@@ -182,7 +184,13 @@ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, c
*array = PyMem_Malloc(size * sizeof(float));
- return mathutils_array_parse_fast(*array, size, value_fast, error_prefix);
+ ret = mathutils_array_parse_fast(*array, size, value_fast, error_prefix);
+
+ if (ret == -1) {
+ PyMem_Free(*array);
+ }
+
+ return ret;
}
}