X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=parsers.c;h=fdf8562f365f73a04a4099f361eadceade29e191;hb=7cb9889f780a78f728c10717625e288a20ea69cb;hp=b895825030b9052433eebaf1f6c443dc02b19eb2;hpb=43e5747a59ed92243c217f7e36da2ac35bbcd80d;p=sigrok-cli.git diff --git a/parsers.c b/parsers.c index b895825..fdf8562 100644 --- a/parsers.c +++ b/parsers.c @@ -33,7 +33,9 @@ char **parse_probestring(int max_probes, const char *probestring) error = FALSE; range = NULL; - probelist = g_malloc0(max_probes * sizeof(char *)); + if (!(probelist = g_try_malloc0(max_probes * sizeof(char *)))) { + /* TODO: Handle errors. */ + } tokens = g_strsplit(probestring, ",", max_probes); for (i = 0; tokens[i]; i++) { @@ -147,7 +149,7 @@ struct sr_device *parse_devicestring(const char *devicestring) devices = sr_device_list(); for (l = devices; l; l = l->next) { d = l->data; - if (strstr(d->plugin->name, "demo")) + if (sr_device_has_hwcap(d, SR_HWCAP_DEMO_DEVICE)) continue; if (device_cnt == device_num) { if (device_num == device_cnt) {