summaryrefslogtreecommitdiff
path: root/src/pl/plpython/plpy_main.c
diff options
context:
space:
mode:
authorTom Lane2012-03-13 19:26:32 +0000
committerTom Lane2012-03-13 19:26:32 +0000
commit5cd72c7a7c7bd76ab028e1dc59d90a47750acebe (patch)
treec8200b31b4b15951a16a5cb0bb42f9805360574d /src/pl/plpython/plpy_main.c
parenta14fa84693659c4c4a17204406945b29fae3d9c4 (diff)
Patch some corner-case bugs in pl/python.
Dave Malcolm of Red Hat is working on a static code analysis tool for Python-related C code. It reported a number of problems in plpython, most of which were failures to check for NULL results from object-creation functions, so would only be an issue in very-low-memory situations. Patch in HEAD and 9.1. We could go further back but it's not clear that these issues are important enough to justify the work. Jan UrbaƄski
Diffstat (limited to 'src/pl/plpython/plpy_main.c')
-rw-r--r--src/pl/plpython/plpy_main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c
index 277dedc22d2..c126db995ae 100644
--- a/src/pl/plpython/plpy_main.c
+++ b/src/pl/plpython/plpy_main.c
@@ -142,6 +142,8 @@ PLy_init_interp(void)
Py_INCREF(mainmod);
PLy_interp_globals = PyModule_GetDict(mainmod);
PLy_interp_safe_globals = PyDict_New();
+ if (PLy_interp_safe_globals == NULL)
+ PLy_elog(ERROR, "could not create globals");
PyDict_SetItemString(PLy_interp_globals, "GD", PLy_interp_safe_globals);
Py_DECREF(mainmod);
if (PLy_interp_globals == NULL || PyErr_Occurred())