summaryrefslogtreecommitdiff
path: root/psycopg/psycopgmodule.c
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2015-10-01 17:02:43 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2015-10-01 17:04:29 +0100
commitc73c1c577170f51c2dfadcdb61c34e4def82d709 (patch)
tree8efc018b88496e5e0478806573c4d765f449d25c /psycopg/psycopgmodule.c
parentf635547ec690cc76b02da8e22772d41008fcc46e (diff)
downloadpsycopg2-c73c1c577170f51c2dfadcdb61c34e4def82d709.tar.gz
Decref the ssl module after importing
Diffstat (limited to 'psycopg/psycopgmodule.c')
-rw-r--r--psycopg/psycopgmodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c
index 737a781..c77dce5 100644
--- a/psycopg/psycopgmodule.c
+++ b/psycopg/psycopgmodule.c
@@ -234,13 +234,16 @@ psyco_register_type(PyObject *self, PyObject *args)
static void
psyco_libcrypto_threads_init(void)
{
+ PyObject *m;
+
/* importing the ssl module sets up Python's libcrypto callbacks */
- if (PyImport_ImportModule("ssl") != NULL) {
+ if ((m = PyImport_ImportModule("ssl"))) {
/* disable libcrypto setup in libpq, so it won't stomp on the callbacks
that have already been set up */
#if PG_VERSION_NUM >= 80400
PQinitOpenSSL(1, 0);
#endif
+ Py_DECREF(m);
}
else {
/* might mean that Python has been compiled without OpenSSL support,