File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020
2121/* Helper for function below. */
2222#define ADD_ENUM (dict , name ) \
23- PyDict_SetItemString(dict, #name, PyInt_FromLong(name))
23+ tmp = PyInt_FromLong(name); \
24+ PyDict_SetItemString(dict, #name, tmp); \
25+ Py_XDECREF(tmp);
2426
2527/* Alas, EPICS has changed the numerical assignments of the DBF_ enums between
2628 * versions, so to avoid unpleasant surprises, we compute thes values here in C
2729 * and pass them back to the Python layer. */
2830static PyObject * get_DBF_values (PyObject * self , PyObject * args )
2931{
3032 PyObject * dict = PyDict_New ();
33+ PyObject * tmp ;
3134 ADD_ENUM (dict , DBF_STRING );
3235 ADD_ENUM (dict , DBF_CHAR );
3336 ADD_ENUM (dict , DBF_UCHAR );
@@ -77,6 +80,7 @@ static PyObject *get_field_offsets(PyObject *self, PyObject *args)
7780 dbentry .pflddes -> size ,
7881 dbentry .pflddes -> field_type );
7982 PyDict_SetItemString (dict , field_name , ost );
83+ Py_XDECREF (ost );
8084 status = dbNextField (& dbentry , 0 );
8185 }
8286
You can’t perform that action at this time.
0 commit comments