summaryrefslogtreecommitdiffstats
path: root/Parser/myreadline.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-04-10 06:42:25 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-04-10 06:42:25 (GMT)
commit2c4e4f98397bcc591ad3a551e1e57cea0e2bd986 (patch)
treef200b67e22e157d409945e29f400e9766eb61beb /Parser/myreadline.c
parent65c05b20e97a493b917fa71f10535512c713c662 (diff)
downloadcpython-2c4e4f98397bcc591ad3a551e1e57cea0e2bd986.zip
cpython-2c4e4f98397bcc591ad3a551e1e57cea0e2bd986.tar.gz
cpython-2c4e4f98397bcc591ad3a551e1e57cea0e2bd986.tar.bz2
SF patch #1467512, fix double free with triple quoted string in standard build.
This was the result of inconsistent use of PyMem_* and PyObject_* allocators. By changing to use PyObject_* allocator almost everywhere, this removes the inconsistency.
Diffstat (limited to 'Parser/myreadline.c')
-rw-r--r--Parser/myreadline.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index a932a87..630997b 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -111,7 +111,7 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
size_t n;
char *p;
n = 100;
- if ((p = PyMem_MALLOC(n)) == NULL)
+ if ((p = PyObject_MALLOC(n)) == NULL)
return NULL;
fflush(sys_stdout);
#ifndef RISCOS
@@ -130,7 +130,7 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
case 0: /* Normal case */
break;
case 1: /* Interrupt */
- PyMem_FREE(p);
+ PyObject_FREE(p);
return NULL;
case -1: /* EOF */
case -2: /* Error */
@@ -141,7 +141,7 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
n = strlen(p);
while (n > 0 && p[n-1] != '\n') {
size_t incr = n+2;
- p = PyMem_REALLOC(p, n + incr);
+ p = PyObject_REALLOC(p, n + incr);
if (p == NULL)
return NULL;
if (incr > INT_MAX) {
@@ -151,14 +151,14 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
break;
n += strlen(p+n);
}
- return PyMem_REALLOC(p, n+1);
+ return PyObject_REALLOC(p, n+1);
}
/* By initializing this function pointer, systems embedding Python can
override the readline function.
- Note: Python expects in return a buffer allocated with PyMem_Malloc. */
+ Note: Python expects in return a buffer allocated with PyObject_Malloc. */
char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);