hameg-hmo: Avoid a double-free.
Avoid double memory freeing leading to segmentation fault in when a SCPI command fails to get a string due conditions such as a timeout or an invalid command.
This commit is contained in:
parent
4fa4db2c79
commit
673989692c
|
@ -439,10 +439,8 @@ static int scope_state_get_array_option(struct sr_scpi_dev_inst *scpi,
|
|||
char *tmp;
|
||||
int idx;
|
||||
|
||||
if (sr_scpi_get_string(scpi, command, &tmp) != SR_OK) {
|
||||
g_free(tmp);
|
||||
if (sr_scpi_get_string(scpi, command, &tmp) != SR_OK)
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
if ((idx = std_str_idx_s(tmp, *array, n)) < 0) {
|
||||
g_free(tmp);
|
||||
|
|
Loading…
Reference in New Issue