]> granicus.if.org Git - python/commitdiff
PyUnicode_FromEncodedObject(): Repair memory leak in an error case.
authorTim Peters <tim.peters@gmail.com>
Tue, 11 Sep 2001 02:00:50 +0000 (02:00 +0000)
committerTim Peters <tim.peters@gmail.com>
Tue, 11 Sep 2001 02:00:50 +0000 (02:00 +0000)
Objects/unicodeobject.c

index a9b4eb2fc6b20daf5753f9f4f19b45f68e13f2f1..98691fddcd6eeb6c78122e01072d05fe6ff7b6e9 100644 (file)
@@ -424,13 +424,13 @@ PyObject *PyUnicode_FromEncodedObject(register PyObject *obj,
        owned = 1;
     }
     if (PyUnicode_Check(obj)) {
-       Py_INCREF(obj);
-       v = obj;
        if (encoding) {
            PyErr_SetString(PyExc_TypeError,
                            "decoding Unicode is not supported");
            return NULL;
        }
+       Py_INCREF(obj);
+       v = obj;
        goto done;
     }
     else if (PyString_Check(obj)) {