Skip to content

Commit ebb58e9

Browse files
committed
fix 0init?
1 parent 13d31fe commit ebb58e9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Modules/hmacmodule.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,12 @@ hmac_new_object(PyTypeObject *tp)
741741
return NULL;
742742
}
743743
HASHLIB_INIT_MUTEX(self);
744-
// tp_alloc initializes the memory to zero but the unknown kind is -1
744+
// PyObject_GC_New() does not zero-initialize
745+
self->name = NULL;
745746
self->kind = Py_hmac_kind_hash_unknown;
747+
self->block_size = self->digest_size = 0;
748+
self->api = (py_hmac_hacl_api){.compute = NULL, .compute_py = NULL};
749+
self->state = NULL;
746750
return self;
747751
}
748752

0 commit comments

Comments
 (0)