diff Python/dynload_win.c @ 72592:8d29cdf28216

Check error when calling PyUnicode_AppendAndDel()
author Victor Stinner <victor.stinner@haypocalc.com>
date Sun, 02 Oct 2011 20:35:10 +0200
parents f8aacfd3b070
children 071cc767a28e
line wrap: on
line diff
--- a/Python/dynload_win.c	Sun Oct 02 19:00:15 2011 +0200
+++ b/Python/dynload_win.c	Sun Oct 02 20:35:10 2011 +0200
@@ -187,7 +187,7 @@
         HINSTANCE hDLL = NULL;
         unsigned int old_mode;
         ULONG_PTR cookie = 0;
-        
+
         /* Don't display a message box when Python can't load a DLL */
         old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
 
@@ -248,8 +248,10 @@
                         theInfo,
                         theLength));
             }
-            PyErr_SetObject(PyExc_ImportError, message);
-            Py_XDECREF(message);
+            if (message != NULL) {
+                PyErr_SetObject(PyExc_ImportError, message);
+                Py_DECREF(message);
+            }
             return NULL;
         } else {
             char buffer[256];