aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2016-07-17 19:39:04 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2016-07-17 19:39:04 +0200
commit236303160c955ee58f08d00739b16da37386e6cc (patch)
tree3962b76dbce035d33ffa4089e3a7835d82687955
parentced48274051be6b3b1ed612260c893fdb2525946 (diff)
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.
-rw-r--r--src/std.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/std.c b/src/std.c
index 7cd2313..a325371 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;