]> sigrok.org Git - libsigrok.git/commitdiff
hp-3457a: free memory that was allocated by SCPI get routines
authorGerhard Sittig <redacted>
Sun, 16 May 2021 12:43:58 +0000 (14:43 +0200)
committerGerhard Sittig <redacted>
Sat, 22 May 2021 06:06:58 +0000 (08:06 +0200)
The SCPI get routines may allocate memory for response data which
callers have to free after use.

This addresses part of bug #1683.

src/hardware/hp-3457a/api.c

index 64fdab54deef5cbc875d57f3b3c07fbb84a498c5..6e42bb9ac91f23b1ad8c0c4cce47284763e96997 100644 (file)
@@ -138,8 +138,10 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
        if ((ret != SR_OK) || !response)
                return NULL;
 
-       if (strcmp(response, "HP3457A"))
+       if (strcmp(response, "HP3457A")) {
+               g_free(response);
                return NULL;
+       }
 
        g_free(response);