X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fdevice.c;h=f3a76ac269b9a67a7f0f765a8e509d4138736663;hb=61b0292217465ea50ebbf8f9c960330d8c1cbacd;hp=ced46fa120fc665d58e672be109227c8b6c02ca0;hpb=0157fdce99dfb867b68a0799cfa3d5586042cb1f;p=libsigrok.git diff --git a/src/device.c b/src/device.c index ced46fa1..f3a76ac2 100644 --- a/src/device.c +++ b/src/device.c @@ -247,6 +247,7 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int status, SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi) { struct sr_channel *ch; + struct sr_channel_group *cg; GSList *l; for (l = sdi->channels; l; l = l->next) { @@ -257,8 +258,11 @@ SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi) } g_slist_free(sdi->channels); - if (sdi->channel_groups) - g_slist_free(sdi->channel_groups); + for (l = sdi->channel_groups; l; l = l->next) { + cg = l->data; + g_free(cg->priv); + } + g_slist_free(sdi->channel_groups); g_free(sdi->vendor); g_free(sdi->model); @@ -570,6 +574,18 @@ SR_API const char *sr_dev_inst_connid_get(struct sr_dev_inst *sdi) if (!sdi) return NULL; + #ifdef HAVE_LIBSERIALPORT + struct sr_serial_dev_inst *serial; + + if ((!sdi->connection_id) && (sdi->inst_type == SR_INST_SERIAL)) { + /* connection_id isn't populated, let's do that here. */ + + serial = sdi->conn; + sdi->connection_id = g_strdup(serial->port); + } + #endif + + if ((!sdi->connection_id) && (sdi->inst_type == SR_INST_USB)) { /* connection_id isn't populated, let's do that here. */