[Python-checkins] python/dist/src/Python compile.c,2.234.4.3,2.234.4.4

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
Sun, 11 Aug 2002 08:40:38 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv22935/Python

Modified Files:
      Tag: release22-maint
	compile.c 
Log Message:
SF bug # 557028, illegal use of malloc/free

This only applies to 2.2.  Use PyMem_Malloc/Free instead of malloc/free.


Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.234.4.3
retrieving revision 2.234.4.4
diff -C2 -d -r2.234.4.3 -r2.234.4.4
*** compile.c	3 Mar 2002 21:32:00 -0000	2.234.4.3
--- compile.c	11 Aug 2002 15:40:35 -0000	2.234.4.4
***************
*** 1959,1963 ****
  		}
  		if (childtype == MINUS) {
! 			char *s = malloc(strlen(STR(pnum)) + 2);
  			if (s == NULL) {
  				com_error(c, PyExc_MemoryError, "");
--- 1959,1963 ----
  		}
  		if (childtype == MINUS) {
! 			char *s = PyMem_Malloc(strlen(STR(pnum)) + 2);
  			if (s == NULL) {
  				com_error(c, PyExc_MemoryError, "");
***************
*** 1967,1971 ****
  			s[0] = '-';
  			strcpy(s + 1, STR(pnum));
! 			free(STR(pnum));
  			STR(pnum) = s;
  		}
--- 1967,1971 ----
  			s[0] = '-';
  			strcpy(s + 1, STR(pnum));
! 			PyMem_Free(STR(pnum));
  			STR(pnum) = s;
  		}