hameg-hmo: Fix two potential memory leaks.

Reported by scan-build:

  src/hardware/hameg-hmo/api.c:533:12: warning: Potential leak of memory pointed to by 'pod_enabled'
                                  return SR_ERR;
                                         ^~~~~~
This commit is contained in:
Uwe Hermann 2018-05-19 21:54:15 +02:00
parent 24801f4e80
commit 4fc4b8e7aa
1 changed files with 6 additions and 2 deletions

View File

@ -529,8 +529,10 @@ static int hmo_setup_channels(const struct sr_dev_inst *sdi)
(*model->scpi_dialect)[SCPI_CMD_SET_ANALOG_CHAN_STATE],
ch->index + 1, ch->enabled);
if (sr_scpi_send(scpi, command) != SR_OK)
if (sr_scpi_send(scpi, command) != SR_OK) {
g_free(pod_enabled);
return SR_ERR;
}
state->analog_channels[ch->index].state = ch->enabled;
setup_changed = TRUE;
break;
@ -548,8 +550,10 @@ static int hmo_setup_channels(const struct sr_dev_inst *sdi)
(*model->scpi_dialect)[SCPI_CMD_SET_DIG_CHAN_STATE],
ch->index, ch->enabled);
if (sr_scpi_send(scpi, command) != SR_OK)
if (sr_scpi_send(scpi, command) != SR_OK) {
g_free(pod_enabled);
return SR_ERR;
}
state->digital_channels[ch->index] = ch->enabled;
setup_changed = TRUE;