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:
parent
ff85a7f0ab
commit
83d38ed90a
|
@ -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);
|
ret = sr_scpi_get_string(sdi->conn, command, &response);
|
||||||
if (ret != SR_OK)
|
if (ret != SR_OK)
|
||||||
return ret;
|
return ret;
|
||||||
if (!response || !*response)
|
if (!response || !*response) {
|
||||||
|
g_free(response);
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
|
}
|
||||||
have = response;
|
have = response;
|
||||||
if (*have == '"')
|
if (*have == '"')
|
||||||
have++;
|
have++;
|
||||||
|
|
Loading…
Reference in New Issue