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