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

fix memory leak in exception case

parent d8898626
......@@ -412,22 +412,20 @@ cdef class memoryview(object):
else:
item = <void *> array
if self.dtype_is_object:
(<PyObject **> item)[0] = <PyObject *> value
else:
try:
try:
if self.dtype_is_object:
(<PyObject **> item)[0] = <PyObject *> value
else:
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 :)
if self.view.suboffsets != NULL:
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)
free(tmp)
# It would be easy to support indirect dimensions, but it's easier
# to disallow :)
if self.view.suboffsets != NULL:
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):
cdef char *itemp = self.get_item_pointer(index)
......
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