/* The list of protocol decoders. */
SRD_PRIV GSList *pd_list = NULL;
+extern GSList *sessions;
+
/* module_sigrokdecode.c */
extern SRD_PRIV PyObject *mod_sigrokdecode;
}
g_variant_ref_sink(o->def);
d->options = g_slist_append(d->options, o);
+ g_free(key);
+ key = NULL;
}
Py_DecRef(py_keys);
Py_DecRef(py_values);
struct srd_probe *p;
GSList *l;
+ if (!module_name)
+ return SRD_ERR_ARG;
+
srd_dbg("Loading protocol decoder '%s'.", module_name);
py_basedec = py_method = py_attr = NULL;
}
/**
- * Unload decoder module.
+ * Unload the specified protocol decoder.
*
* @param dec The struct srd_decoder to be unloaded.
*
SRD_API int srd_decoder_unload(struct srd_decoder *dec)
{
struct srd_decoder_option *o;
+ struct srd_session *sess;
GSList *l;
srd_dbg("Unloading protocol decoder '%s'.", dec->name);
* stack. A frontend reloading a decoder thus has to restart all
* instances, and rebuild the stack.
*/
- srd_inst_free_all(NULL);
+ for (l = sessions; l; l = l->next) {
+ sess = l->data;
+ srd_inst_free_all(sess, NULL);
+ }
for (l = dec->options; l; l = l->next) {
o = l->data;
/* The module itself. */
Py_XDECREF(dec->py_mod);
- /* TODO: (g_)free dec itself? */
+ g_free(dec);
return SRD_OK;
}