output: fix options memory leak
This commit is contained in:
parent
2dbe445d55
commit
da3d141f04
|
@ -355,22 +355,6 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(struct sr_output *o)
|
||||
{
|
||||
struct context *ctx;
|
||||
|
||||
if (!o || !o->sdi)
|
||||
return SR_ERR_ARG;
|
||||
ctx = o->priv;
|
||||
|
||||
g_ptr_array_free(ctx->channellist, 1);
|
||||
g_free(ctx->fdata);
|
||||
g_free(ctx);
|
||||
o->priv = NULL;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static struct sr_option options[] = {
|
||||
{ "digits", "Digits", "Digits to show", NULL, NULL },
|
||||
ALL_ZERO
|
||||
|
@ -389,6 +373,24 @@ static const struct sr_option *get_options(void)
|
|||
return options;
|
||||
}
|
||||
|
||||
static int cleanup(struct sr_output *o)
|
||||
{
|
||||
struct context *ctx;
|
||||
|
||||
if (!o || !o->sdi)
|
||||
return SR_ERR_ARG;
|
||||
ctx = o->priv;
|
||||
|
||||
g_ptr_array_free(ctx->channellist, 1);
|
||||
g_variant_unref(options[0].def);
|
||||
g_slist_free_full(options[0].values, (GDestroyNotify)g_variant_unref);
|
||||
g_free(ctx->fdata);
|
||||
g_free(ctx);
|
||||
o->priv = NULL;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV struct sr_output_module output_analog = {
|
||||
.id = "analog",
|
||||
.name = "Analog",
|
||||
|
|
|
@ -296,18 +296,6 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(struct sr_output *o)
|
||||
{
|
||||
struct out_context *outc;
|
||||
|
||||
outc = o->priv;
|
||||
g_free(outc->filename);
|
||||
g_free(outc);
|
||||
o->priv = NULL;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static struct sr_option options[] = {
|
||||
ALL_ZERO
|
||||
};
|
||||
|
@ -320,6 +308,19 @@ static const struct sr_option *get_options(void)
|
|||
return options;
|
||||
}
|
||||
|
||||
static int cleanup(struct sr_output *o)
|
||||
{
|
||||
struct out_context *outc;
|
||||
|
||||
outc = o->priv;
|
||||
g_variant_unref(options[0].def);
|
||||
g_free(outc->filename);
|
||||
g_free(outc);
|
||||
o->priv = NULL;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV struct sr_output_module output_srzip = {
|
||||
.id = "srzip",
|
||||
.name = "srzip",
|
||||
|
|
|
@ -338,23 +338,6 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(struct sr_output *o)
|
||||
{
|
||||
struct out_context *outc;
|
||||
int i;
|
||||
|
||||
outc = o->priv;
|
||||
g_slist_free(outc->channels);
|
||||
for (i = 0; i < outc->num_channels; i++)
|
||||
g_free(outc->chanbuf[i]);
|
||||
g_free(outc->chanbuf_used);
|
||||
g_free(outc->chanbuf);
|
||||
g_free(outc);
|
||||
o->priv = NULL;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static struct sr_option options[] = {
|
||||
{ "scale", "Scale", "Scale values by factor", NULL, NULL },
|
||||
ALL_ZERO
|
||||
|
@ -368,6 +351,24 @@ static const struct sr_option *get_options(void)
|
|||
return options;
|
||||
}
|
||||
|
||||
static int cleanup(struct sr_output *o)
|
||||
{
|
||||
struct out_context *outc;
|
||||
int i;
|
||||
|
||||
outc = o->priv;
|
||||
g_slist_free(outc->channels);
|
||||
g_variant_unref(options[0].def);
|
||||
for (i = 0; i < outc->num_channels; i++)
|
||||
g_free(outc->chanbuf[i]);
|
||||
g_free(outc->chanbuf_used);
|
||||
g_free(outc->chanbuf);
|
||||
g_free(outc);
|
||||
o->priv = NULL;
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV struct sr_output_module output_wav = {
|
||||
.id = "wav",
|
||||
.name = "WAV",
|
||||
|
|
Loading…
Reference in New Issue