From: Uwe Hermann Date: Sun, 13 Feb 2011 10:27:52 +0000 (+0100) Subject: Quickfix for a segfault with file input via -i. X-Git-Tag: libsigrok-0.1.0~330 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=218557b85a308adc6ac533eb3f33d3dee17c13f8;p=libsigrok.git Quickfix for a segfault with file input via -i. Stuff like ./bin/sigrok-cli -i rnd.dd -a transitioncounter would segfault (rnd.dd consists of random bytes) because device->plugin was NULL and was being dereferenced. Thanks Olivier Fauchon for reporting. --- diff --git a/device.c b/device.c index 2dee902c..04d463c1 100644 --- a/device.c +++ b/device.c @@ -235,6 +235,9 @@ gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap) { int *capabilities, i; + if (!device || !device->plugin) + return; + if ((capabilities = device->plugin->get_capabilities())) for (i = 0; capabilities[i]; i++) if (capabilities[i] == hwcap)