Commit 095a289a authored by Stefan Behnel's avatar Stefan Behnel

fix memory leak in exception case

parent d8898626
......@@ -412,14 +412,11 @@ cdef class memoryview(object):
else:
item = <void *> array
try:
if self.dtype_is_object:
(<PyObject **> item)[0] = <PyObject *> value
else:
try:
self.assign_item_from_object(<char *> item, value)
except:
free(tmp)
raise
# It would be easy to support indirect dimensions, but it's easier
# to disallow :)
......@@ -427,6 +424,7 @@ cdef class memoryview(object):
assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
item, self.dtype_is_object)
finally:
free(tmp)
cdef setitem_indexed(self, index, value):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment