From b674adbd20c60019f8b503a3f03a4bdf83f187e1 Mon Sep 17 00:00:00 2001 From: Vincent Castellano Date: Thu, 7 May 2015 00:24:45 -0700 Subject: [PATCH] Py_DECREF the results from python calls in callbacks --- python-tg.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python-tg.c b/python-tg.c index 3229043..da2564b 100644 --- a/python-tg.c +++ b/python-tg.c @@ -374,6 +374,7 @@ void py_binlog_end (void) { else if(PyString_Check(result)) logprintf ("python: %s\n", PyString_AsString(result)); + Py_DECREF(result); } void py_diff_end (void) { @@ -387,6 +388,8 @@ void py_diff_end (void) { PyErr_Print(); else if(PyString_Check(result)) logprintf ("python: %s\n", PyString_AsString(result)); + + Py_DECREF(result); } void py_our_id (int id) { @@ -400,6 +403,8 @@ void py_our_id (int id) { PyErr_Print(); else if(PyString_Check(result)) logprintf ("python: %s\n", PyString_AsString(result)); + + Py_DECREF(result); } void py_new_msg (struct tgl_message *M) { @@ -418,6 +423,7 @@ void py_new_msg (struct tgl_message *M) { else if(PyString_Check(result)) logprintf ("python: %s\n", PyString_AsString(result)); + Py_DECREF(result); } void py_secret_chat_update (struct tgl_secret_chat *C, unsigned flags) { @@ -437,6 +443,7 @@ void py_secret_chat_update (struct tgl_secret_chat *C, unsigned flags) { else if(PyString_Check(result)) logprintf ("python: %s\n", PyString_AsString(result)); + Py_DECREF(result); } @@ -457,6 +464,7 @@ void py_user_update (struct tgl_user *U, unsigned flags) { else if(PyString_Check(result)) logprintf ("python: %s\n", PyString_AsString(result)); + Py_DECREF(result); } void py_chat_update (struct tgl_chat *C, unsigned flags) { @@ -476,6 +484,8 @@ void py_chat_update (struct tgl_chat *C, unsigned flags) { PyErr_Print(); else if(PyString_Check(result)) logprintf ("python: %s\n", PyString_AsString(result)); + + Py_DECREF(result); } ////extern tgl_peer_t *Peers[];