diff --git a/Python/import.c b/Python/import.c index 2cac9b5..bb77ccc 100644 --- a/Python/import.c +++ b/Python/import.c @@ -995,8 +995,10 @@ load_source_module(char *name, char *pathname, FILE *fp) fclose(fpc); if (co == NULL) return NULL; - if (update_compiled_module(co, pathname) < 0) + if (update_compiled_module(co, pathname) < 0) { + Py_DECREF(co); return NULL; + } if (Py_VerboseFlag) PySys_WriteStderr("import %s # precompiled from %s\n", name, cpathname);