Ticket #166: cspeedups-fix-memleak-r780.2.diff
| File cspeedups-fix-memleak-r780.2.diff, 2.2 KB (added by cboos, 13 months ago) |
|---|
-
trunk/genshi/_speedups.c
87 87 88 88 out = (PyUnicodeObject*) PyUnicode_FromUnicode(NULL, len); 89 89 if (out == NULL) { 90 Py_DECREF((PyObject *) in); 90 91 return NULL; 91 92 } 92 93 … … 130 131 inp++; 131 132 } 132 133 134 Py_DECREF((PyObject *) in); 135 133 136 args = PyTuple_New(1); 134 137 if (args == NULL) { 135 138 Py_DECREF((PyObject *) out); … … 242 245 Markup_join(PyObject *self, PyObject *args, PyObject *kwds) 243 246 { 244 247 static char *kwlist[] = {"seq", "escape_quotes", 0}; 245 PyObject *seq = NULL, *seq2, *tmp ;248 PyObject *seq = NULL, *seq2, *tmp, *tmp2; 246 249 char quotes = 1; 247 250 int n, i; 248 251 … … 266 269 Py_DECREF(seq2); 267 270 return NULL; 268 271 } 269 tmp = escape(tmp, quotes);270 if (tmp == NULL) {272 tmp2 = escape(tmp, quotes); 273 if (tmp2 == NULL) { 271 274 Py_DECREF(seq2); 272 275 return NULL; 273 276 } 274 PyTuple_SET_ITEM(seq2, i, tmp); 277 PyTuple_SET_ITEM(seq2, i, tmp2); 278 Py_DECREF(tmp); 275 279 } 276 280 tmp = PyUnicode_Join(self, seq2); 277 281 Py_DECREF(seq2); … … 303 307 return NULL; 304 308 tmp2 = PyUnicode_Concat(tmp, other); 305 309 } 306 if (tmp2 == NULL) {307 Py_DECREF(tmp);310 Py_DECREF(tmp); 311 if (tmp2 == NULL) 308 312 return NULL; 309 }310 Py_DECREF(tmp);311 313 args = PyTuple_New(1); 312 314 if (args == NULL) { 313 315 Py_DECREF(tmp2); … … 380 382 if (unicode == NULL) return NULL; 381 383 result = PyNumber_Multiply(unicode, self); 382 384 } 385 Py_DECREF(unicode); 383 386 384 387 if (result == NULL) return NULL; 385 388 args = PyTuple_New(1); … … 402 405 format = PyString_FromString("<Markup %r>"); 403 406 if (format == NULL) return NULL; 404 407 result = PyObject_Unicode(self); 405 if (result == NULL) return NULL; 408 if (result == NULL) { 409 Py_DECREF(format); 410 return NULL; 411 } 406 412 args = PyTuple_New(1); 407 413 if (args == NULL) { 414 Py_DECREF(format); 408 415 Py_DECREF(result); 409 416 return NULL; 410 417 }
