]> sigrok.org Git - libsigrok.git/commitdiff
siglent-sds: Fix two memory leaks.
authorUwe Hermann <redacted>
Sun, 18 Feb 2018 22:36:17 +0000 (23:36 +0100)
committerUwe Hermann <redacted>
Sun, 18 Feb 2018 22:36:17 +0000 (23:36 +0100)
src/hardware/siglent-sds/api.c

index ce27b1e29a23c7a1259474a3f9b8f3fa20fb1d92..ebefa4bca5a4b26f6742bf7630c51cbac0b63021 100644 (file)
@@ -593,7 +593,9 @@ static int config_set(uint32_t key, GVariant *data,
                        break;
                }
                sr_dbg("Setting device timebase: TDIV %s.", cmd);
-               return siglent_sds_config_set(sdi, "TDIV %s", cmd);
+               ret = siglent_sds_config_set(sdi, "TDIV %s", cmd);
+               g_free(cmd);
+               return ret;
        case SR_CONF_TRIGGER_SOURCE:
                if ((idx = std_str_idx(data, ARRAY_AND_SIZE(trigger_sources))) < 0)
                        return SR_ERR_ARG;
@@ -636,7 +638,9 @@ static int config_set(uint32_t key, GVariant *data,
                        cmd = g_strdup_printf("%" PRIu64 "UV", p);
                        break;
                }
-               return siglent_sds_config_set(sdi, "C%d:VDIV %s", i + 1, cmd);
+               ret = siglent_sds_config_set(sdi, "C%d:VDIV %s", i + 1, cmd);
+               g_free(cmd);
+               return ret;
        case SR_CONF_COUPLING:
                if (!cg)
                        return SR_ERR_CHANNEL_GROUP;