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:
Guido Trentalancia 2018-11-16 18:48:36 +01:00 committed by Uwe Hermann
parent 4fa4db2c79
commit 673989692c
1 changed files with 1 additions and 3 deletions

View File

@ -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);