]> sigrok.org Git - libsigrok.git/commitdiff
pickit2: avoid NULL dereference in close code path
authorGerhard Sittig <redacted>
Wed, 19 Dec 2018 11:41:29 +0000 (12:41 +0100)
committerUwe Hermann <redacted>
Thu, 27 Dec 2018 10:26:19 +0000 (11:26 +0100)
src/hardware/microchip-pickit2/api.c

index 48fb849a9a001e3f14042bfa85f7d876a73d2b3d..4eb755d274d057e3eae731e378c8f815b9589e4e 100644 (file)
@@ -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;