summaryrefslogtreecommitdiff
path: root/ext/digest/digest.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/digest/digest.c')
-rw-r--r--ext/digest/digest.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index ed96c2f..239fe7c 100644
--- a/ext/digest/digest.c
+++ b/ext/digest/digest.c
@@ -565,11 +565,10 @@ rb_digest_base_alloc(VALUE klass)
algo = get_digest_base_metadata(klass);
- pctx = xmalloc(algo->ctx_size);
+ obj = rb_data_typed_object_zalloc(klass, algo->ctx_size, &digest_type);
+ pctx = RTYPEDDATA_DATA(obj);
algo_init(algo, pctx);
- obj = TypedData_Wrap_Struct(klass, &digest_type, pctx);
-
return obj;
}