From: Gerhard Sittig Date: Wed, 19 Dec 2018 11:41:29 +0000 (+0100) Subject: pickit2: avoid NULL dereference in close code path X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=fbbf21dcf5d16385ae75f786041b3c4a497662b5;p=libsigrok.git pickit2: avoid NULL dereference in close code path --- diff --git a/src/hardware/microchip-pickit2/api.c b/src/hardware/microchip-pickit2/api.c index 48fb849a..4eb755d2 100644 --- a/src/hardware/microchip-pickit2/api.c +++ b/src/hardware/microchip-pickit2/api.c @@ -232,6 +232,8 @@ static int dev_close(struct sr_dev_inst *sdi) usb = sdi->conn; devc = sdi->priv; + if (!usb) + return SR_OK; if (!usb->devhdl) return SR_OK;