Mercurial > hg
comparison mercurial/parsers.c @ 23942:fefa5f2a1730 stable
parsers: fix leak of err when asciilower hits a unicode decode error
This is one of many errors detected in parsers.c by cpychecker[1]. I
haven't gone through all of them yet.
1: https://gcc-python-plugin.readthedocs.org/en/latest/index.html
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 23 Jan 2015 15:19:04 -0500 |
parents | ee311681e591 |
children | 5fb44983a696 |
comparison
equal
deleted
inserted
replaced
23941:164bd5218ddb | 23942:fefa5f2a1730 |
---|---|
113 if (c & 0x80) { | 113 if (c & 0x80) { |
114 PyObject *err = PyUnicodeDecodeError_Create( | 114 PyObject *err = PyUnicodeDecodeError_Create( |
115 "ascii", str, len, i, (i + 1), | 115 "ascii", str, len, i, (i + 1), |
116 "unexpected code byte"); | 116 "unexpected code byte"); |
117 PyErr_SetObject(PyExc_UnicodeDecodeError, err); | 117 PyErr_SetObject(PyExc_UnicodeDecodeError, err); |
118 Py_XDECREF(err); | |
118 goto quit; | 119 goto quit; |
119 } | 120 } |
120 newstr[i] = lowertable[(unsigned char)c]; | 121 newstr[i] = lowertable[(unsigned char)c]; |
121 } | 122 } |
122 | 123 |