summaryrefslogtreecommitdiff
path: root/ext/-test-
diff options
context:
space:
mode:
authorKenta Murata <mrkn@mrkn.jp>2020-12-23 00:40:54 +0900
committerKenta Murata <mrkn@mrkn.jp>2020-12-23 09:24:54 +0900
commitb3ea828c8ef92f2fab4646f72144f7c468339a81 (patch)
tree8809e6d07f1bf219150ccc6f0b0cfb0c4f7628e2 /ext/-test-
parent74652e640a3ef50eb5442eb98438e3d634a4faf7 (diff)
[memory_view] Add mdview_release_view for test
Diffstat (limited to 'ext/-test-')
-rw-r--r--ext/-test-/memory_view/memory_view.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/-test-/memory_view/memory_view.c b/ext/-test-/memory_view/memory_view.c
index c847eac98ab..cb07064cd72 100644
--- a/ext/-test-/memory_view/memory_view.c
+++ b/ext/-test-/memory_view/memory_view.c
@@ -307,6 +307,16 @@ mdview_get_memory_view(VALUE obj, rb_memory_view_t *view, int flags)
view->ndim = ndim;
view->shape = shape;
view->strides = strides;
+ view->sub_offsets = NULL;
+
+ return true;
+}
+
+static bool
+mdview_release_memory_view(VALUE obj, rb_memory_view_t *view)
+{
+ if (view->shape) xfree(view->shape);
+ if (view->strides) xfree(view->strides);
return true;
}
@@ -319,7 +329,7 @@ mdview_memory_view_available_p(VALUE obj)
static const rb_memory_view_entry_t mdview_memory_view_entry = {
mdview_get_memory_view,
- NULL,
+ mdview_release_memory_view,
mdview_memory_view_available_p
};