@@ -561,13 +561,12 @@ compiler_enter_scope(struct compiler *c, identifier name,
561561 struct compiler_unit * u ;
562562 basicblock * block ;
563563
564- u = (struct compiler_unit * )PyObject_Malloc ( sizeof (
564+ u = (struct compiler_unit * )PyObject_Calloc ( 1 , sizeof (
565565 struct compiler_unit ));
566566 if (!u ) {
567567 PyErr_NoMemory ();
568568 return 0 ;
569569 }
570- memset (u , 0 , sizeof (struct compiler_unit ));
571570 u -> u_scope_type = scope_type ;
572571 u -> u_argcount = 0 ;
573572 u -> u_posonlyargcount = 0 ;
@@ -770,12 +769,11 @@ compiler_new_block(struct compiler *c)
770769 struct compiler_unit * u ;
771770
772771 u = c -> u ;
773- b = (basicblock * )PyObject_Malloc ( sizeof (basicblock ));
772+ b = (basicblock * )PyObject_Calloc ( 1 , sizeof (basicblock ));
774773 if (b == NULL ) {
775774 PyErr_NoMemory ();
776775 return NULL ;
777776 }
778- memset ((void * )b , 0 , sizeof (basicblock ));
779777 /* Extend the singly linked list of blocks with new block. */
780778 b -> b_list = u -> u_blocks ;
781779 u -> u_blocks = b ;
@@ -812,15 +810,13 @@ compiler_next_instr(basicblock *b)
812810{
813811 assert (b != NULL );
814812 if (b -> b_instr == NULL ) {
815- b -> b_instr = (struct instr * )PyObject_Malloc (
816- sizeof (struct instr ) * DEFAULT_BLOCK_SIZE );
813+ b -> b_instr = (struct instr * )PyObject_Calloc (
814+ DEFAULT_BLOCK_SIZE , sizeof (struct instr ));
817815 if (b -> b_instr == NULL ) {
818816 PyErr_NoMemory ();
819817 return -1 ;
820818 }
821819 b -> b_ialloc = DEFAULT_BLOCK_SIZE ;
822- memset ((char * )b -> b_instr , 0 ,
823- sizeof (struct instr ) * DEFAULT_BLOCK_SIZE );
824820 }
825821 else if (b -> b_iused == b -> b_ialloc ) {
826822 struct instr * tmp ;
0 commit comments