Commits

Lenard Lindstrom committed 6a2f740

clean up r 2117 bug fix

  • Participants
  • Parent commits 9fdc630

Comments (0)

Files changed (1)

         test = fopen (filename, "rb");
         if(!test)
         {
+            PyObject *tmp = NULL;
+
             if (!strcmp (filename, font_defaultname)) {
-                Py_DECREF (fileobj);
-                fileobj = font_resource (font_defaultname);
+                tmp = font_resource (font_defaultname);
             }
-            else {
-                Py_DECREF (fileobj);
-                fileobj = NULL;
-            }
-            if (!fileobj)
+            if (!tmp)
             {
-                PyErr_SetString (PyExc_IOError, "unable to read font filename");
+                PyErr_SetString (PyExc_IOError,
+                                 "unable to read font filename");
                 goto error;
             }
+            Py_DECREF (fileobj);
+            fileobj = tmp;
         }
         else
         {
     return 0;
 
 error:
-    Py_XDECREF (fileobj);
+    Py_DECREF (fileobj);
     return -1;
 }