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