From: Uwe Hermann Date: Tue, 3 Nov 2015 01:12:49 +0000 (+0100) Subject: srd_decoder_unload(): Remove PD from the internal list. X-Git-Tag: libsigrokdecode-0.4.0~40 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=commitdiff_plain;h=c63f5a875761cb83abfad7ede0615415cdc90c76;ds=sidebyside srd_decoder_unload(): Remove PD from the internal list. This issue was discovered via the newly added unit tests. --- diff --git a/decoder.c b/decoder.c index 6ad4037..748280a 100644 --- a/decoder.c +++ b/decoder.c @@ -39,7 +39,7 @@ /** @cond PRIVATE */ -/* The list of protocol decoders. */ +/* The list of loaded protocol decoders. */ static GSList *pd_list = NULL; /* srd.c */ @@ -64,7 +64,7 @@ static gboolean srd_check_init(void) } /** - * Returns the list of supported/loaded protocol decoders. + * Returns the list of loaded protocol decoders. * * This is a GSList of pointers to struct srd_decoder items. * @@ -704,7 +704,7 @@ SRD_API int srd_decoder_load(const char *module_name) if (get_binary_classes(d) != SRD_OK) goto err_out; - /* Append it to the list of supported/loaded decoders. */ + /* Append it to the list of loaded decoders. */ pd_list = g_slist_append(pd_list, d); return SRD_OK; @@ -787,6 +787,9 @@ SRD_API int srd_decoder_unload(struct srd_decoder *dec) srd_inst_free_all(sess, NULL); } + /* Remove the PD from the list of loaded decoders. */ + pd_list = g_slist_remove(pd_list, dec); + decoder_free(dec); return SRD_OK;