From: Uwe Hermann Date: Sun, 17 Jul 2016 17:39:04 +0000 (+0200) Subject: Fix a segfault with input/output modules. X-Git-Tag: libsigrok-0.5.0~283 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=236303160c955ee58f08d00739b16da37386e6cc;p=libsigrok.git Fix a segfault with input/output modules. Some functions in std.c were using const char *prefix = sdi->driver->name; but were called from input/output modules as well (which don't have a "driver" field). As a temporary workaround, use "unknown" as prefix in such cases until a more permanent solution is implemented. This fixes bug #813. --- diff --git a/src/std.c b/src/std.c index 7cd23131..a325371a 100644 --- a/src/std.c +++ b/src/std.c @@ -91,7 +91,7 @@ SR_PRIV int std_cleanup(const struct sr_dev_driver *di) */ SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi) { - const char *prefix = sdi->driver->name; + const char *prefix = (sdi->driver) ? sdi->driver->name : "unknown"; int ret; struct sr_datafeed_packet packet; struct sr_datafeed_header header; @@ -123,7 +123,7 @@ SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi) */ SR_PRIV int std_session_send_df_end(const struct sr_dev_inst *sdi) { - const char *prefix = sdi->driver->name; + const char *prefix = (sdi->driver) ? sdi->driver->name : "unknown"; int ret; struct sr_datafeed_packet packet;