scpi-dmm: 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.
This commit is contained in:
Gerhard Sittig 2021-05-16 14:52:49 +02:00
parent ff85a7f0ab
commit 83d38ed90a
1 changed files with 3 additions and 1 deletions

View File

@ -100,8 +100,10 @@ SR_PRIV int scpi_dmm_get_mq(const struct sr_dev_inst *sdi,
ret = sr_scpi_get_string(sdi->conn, command, &response);
if (ret != SR_OK)
return ret;
if (!response || !*response)
if (!response || !*response) {
g_free(response);
return SR_ERR_NA;
}
have = response;
if (*have == '"')
have++;