]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
SF bug # 557028, illegal use of malloc/free
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 11 Aug 2002 15:40:35 +0000 (15:40 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 11 Aug 2002 15:40:35 +0000 (15:40 +0000)
This only applies to 2.2.  Use PyMem_Malloc/Free instead of malloc/free.

Python/compile.c

index 6cf13c984794d6e7e4866f7277d7b02863c09453..cdd8b1b3905b39fb8184657561051ee9fa3acd59 100644 (file)
@@ -1958,7 +1958,7 @@ com_factor(struct compiling *c, node *n)
                        return;
                }
                if (childtype == MINUS) {
-                       char *s = malloc(strlen(STR(pnum)) + 2);
+                       char *s = PyMem_Malloc(strlen(STR(pnum)) + 2);
                        if (s == NULL) {
                                com_error(c, PyExc_MemoryError, "");
                                com_addbyte(c, 255);
@@ -1966,7 +1966,7 @@ com_factor(struct compiling *c, node *n)
                        }
                        s[0] = '-';
                        strcpy(s + 1, STR(pnum));
-                       free(STR(pnum));
+                       PyMem_Free(STR(pnum));
                        STR(pnum) = s;
                }
                com_atom(c, patom);