]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hameg-hmo/api.c
hameg-hmo: Fix two potential memory leaks.
[libsigrok.git] / src / hardware / hameg-hmo / api.c
index e4c53887e4ececca857129c47ff09bf2298d87a2..8638a790bc56806954dfe017d8b44d7571e44d71 100644 (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;