X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fsession_file.c;h=8b4f60b592dfcc893600aa80f816a914710765a1;hb=7bfcb25cf1aa4fe7ddc177292bcf2ee4d9b1446d;hp=bd5b827f41734abf8ceb3056c31c264b26d5ba63;hpb=1de3ccede95a7b3535b67c6ade510715fe85d4d3;p=libsigrok.git diff --git a/src/session_file.c b/src/session_file.c index bd5b827f..8b4f60b5 100644 --- a/src/session_file.c +++ b/src/session_file.c @@ -170,8 +170,9 @@ SR_API int sr_session_load(const char *filename, struct sr_session **session) for (j = 0; keys[j]; j++) { val = g_key_file_get_string(kf, sections[i], keys[j], NULL); if (!strcmp(keys[j], "capturefile")) { - sdi = sr_dev_inst_new(SR_ST_ACTIVE, NULL, NULL, NULL); + sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->driver = &session_driver; + sdi->status = SR_ST_ACTIVE; if (!session_driver_initialized) { /* first device, init the driver */ session_driver_initialized = 1; @@ -212,9 +213,8 @@ SR_API int sr_session_load(const char *filename, struct sr_session **session) g_variant_new_uint64(total_channels), sdi, NULL); for (p = 0; p < total_channels; p++) { snprintf(channelname, SR_MAX_CHANNELNAME_LEN, "%" PRIu64, p); - if (!(ch = sr_channel_new(p, SR_CHANNEL_LOGIC, TRUE, - channelname))) - return SR_ERR; + ch = sr_channel_new(p, SR_CHANNEL_LOGIC, TRUE, + channelname); sdi->channels = g_slist_append(sdi->channels, ch); } } else if (!strncmp(keys[j], "probe", 5)) {