[Python-checkins] r85703 - python/branches/pep-382/Python/import.c

barry.warsaw python-checkins at python.org
Tue Oct 19 00:27:44 CEST 2010


Author: barry.warsaw
Date: Tue Oct 19 00:27:44 2010
New Revision: 85703

Log:
Fix a crash when p_result gets passed in as NULL.


Modified:
   python/branches/pep-382/Python/import.c

Modified: python/branches/pep-382/Python/import.c
==============================================================================
--- python/branches/pep-382/Python/import.c	(original)
+++ python/branches/pep-382/Python/import.c	Tue Oct 19 00:27:44 2010
@@ -2504,7 +2504,9 @@
     /* XXX caseok */
     PyObject *result  = NULL;
     int dirlen = strlen(buf);
-    *p_result = NULL;
+    if (p_result != NULL) {
+        *p_result = NULL;
+    }
     DIR *dirp = opendir(buf);
     while(1) {
         struct dirent *entry = readdir(dirp);
@@ -2528,7 +2530,9 @@
             }
         }
     }
-    *p_result = result;
+    if (p_result != NULL ) {
+        *p_result = result;
+    }
     closedir(dirp);
     return result != NULL;
 #else


More information about the Python-checkins mailing list