"a subclass of sigrokdecode.Decoder.", name);
goto err_out;
}
- Py_DecRef(py_basedec);
+ Py_CLEAR(py_basedec);
/* Check for a proper start() method. */
if (!PyObject_HasAttrString(d->py_dec, "start")) {
"is not a method.", name);
goto err_out;
}
- Py_DecRef(py_method);
+ Py_CLEAR(py_method);
/* Check for a proper decode() method. */
if (!PyObject_HasAttrString(d->py_dec, "decode")) {
"is not a method.", name);
goto err_out;
}
- Py_DecRef(py_method);
+ Py_CLEAR(py_method);
/* If present, options must be a dictionary. */
if (PyObject_HasAttrString(d->py_dec, "options")) {
if (!PyDict_Check(py_attr)) {
srd_err("Protocol decoder %s options attribute is not "
"a dictionary.", d->name);
+ Py_DecRef(py_attr);
goto err_out;
}
Py_DecRef(py_attr);
/* The decoder name is the PD directory name (e.g. "i2c"). */
decodername = g_strdup(direntry);
- if (!(dec = g_try_malloc(sizeof(struct srd_decoder))))
- return SRD_ERR_MALLOC;
-
if ((ret = srd_load_decoder(decodername, &dec)) == SRD_OK) {
/* Append it to the list of supported/loaded decoders. */
pd_list = g_slist_append(pd_list, dec);