Blame SOURCES/00186-memory-leak-marshalc.patch
|
|
b7580a |
--- Python-2.7.5/Python/marshal.c 2013-05-12 05:32:53.000000000 +0200
|
|
|
b7580a |
+++ /home/rkuska/hg/cpython/Python/marshal.c 2013-07-18 10:33:26.392486235 +0200
|
|
|
b7580a |
@@ -88,7 +88,7 @@
|
|
|
b7580a |
}
|
|
|
b7580a |
|
|
|
b7580a |
static void
|
|
|
b7580a |
-w_string(char *s, Py_ssize_t n, WFILE *p)
|
|
|
b7580a |
+w_string(const char *s, Py_ssize_t n, WFILE *p)
|
|
|
b7580a |
{
|
|
|
b7580a |
if (p->fp != NULL) {
|
|
|
b7580a |
fwrite(s, 1, n, p->fp);
|
|
|
b7580a |
@@ -141,6 +141,13 @@
|
|
|
b7580a |
# define W_SIZE w_long
|
|
|
b7580a |
#endif
|
|
|
b7580a |
|
|
|
b7580a |
+static void
|
|
|
b7580a |
+w_pstring(const char *s, Py_ssize_t n, WFILE *p)
|
|
|
b7580a |
+{
|
|
|
b7580a |
+ W_SIZE(n, p);
|
|
|
b7580a |
+ w_string(s, n, p);
|
|
|
b7580a |
+}
|
|
|
b7580a |
+
|
|
|
b7580a |
/* We assume that Python longs are stored internally in base some power of
|
|
|
b7580a |
2**15; for the sake of portability we'll always read and write them in base
|
|
|
b7580a |
exactly 2**15. */
|
|
|
b7580a |
@@ -338,9 +345,7 @@
|
|
|
b7580a |
else {
|
|
|
b7580a |
w_byte(TYPE_STRING, p);
|
|
|
b7580a |
}
|
|
|
b7580a |
- n = PyString_GET_SIZE(v);
|
|
|
b7580a |
- W_SIZE(n, p);
|
|
|
b7580a |
- w_string(PyString_AS_STRING(v), n, p);
|
|
|
b7580a |
+ w_pstring(PyBytes_AS_STRING(v), PyString_GET_SIZE(v), p);
|
|
|
b7580a |
}
|
|
|
b7580a |
#ifdef Py_USING_UNICODE
|
|
|
b7580a |
else if (PyUnicode_CheckExact(v)) {
|
|
|
b7580a |
@@ -352,9 +357,7 @@
|
|
|
b7580a |
return;
|
|
|
b7580a |
}
|
|
|
b7580a |
w_byte(TYPE_UNICODE, p);
|
|
|
b7580a |
- n = PyString_GET_SIZE(utf8);
|
|
|
b7580a |
- W_SIZE(n, p);
|
|
|
b7580a |
- w_string(PyString_AS_STRING(utf8), n, p);
|
|
|
b7580a |
+ w_pstring(PyString_AS_STRING(utf8), PyString_GET_SIZE(utf8), p);
|
|
|
b7580a |
Py_DECREF(utf8);
|
|
|
b7580a |
}
|
|
|
b7580a |
#endif
|
|
|
b7580a |
@@ -441,8 +444,7 @@
|
|
|
b7580a |
PyBufferProcs *pb = v->ob_type->tp_as_buffer;
|
|
|
b7580a |
w_byte(TYPE_STRING, p);
|
|
|
b7580a |
n = (*pb->bf_getreadbuffer)(v, 0, (void **)&s);
|
|
|
b7580a |
- W_SIZE(n, p);
|
|
|
b7580a |
- w_string(s, n, p);
|
|
|
b7580a |
+ w_pstring(s, n, p);
|
|
|
b7580a |
}
|
|
|
b7580a |
else {
|
|
|
b7580a |
w_byte(TYPE_UNKNOWN, p);
|