From: Gerhard Sittig Date: Sun, 16 May 2021 12:43:58 +0000 (+0200) Subject: hp-3457a: free memory that was allocated by SCPI get routines X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=1c50255506971b0bdb37fca88c80a8146abbb6e4 hp-3457a: free memory that was allocated by SCPI get routines The SCPI get routines may allocate memory for response data which callers have to free after use. This addresses part of bug #1683. --- diff --git a/src/hardware/hp-3457a/api.c b/src/hardware/hp-3457a/api.c index 64fdab54..6e42bb9a 100644 --- a/src/hardware/hp-3457a/api.c +++ b/src/hardware/hp-3457a/api.c @@ -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);