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.
This commit is contained in:
Uwe Hermann 2016-07-17 19:39:04 +02:00
parent ced4827405
commit 236303160c
1 changed files with 2 additions and 2 deletions

View File

@ -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;