diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 4 | ||||
-rw-r--r-- | src/interface.c | 10 | ||||
-rw-r--r-- | src/pa-sink-ctl.c | 30 |
3 files changed, 38 insertions, 6 deletions
diff --git a/src/config.c b/src/config.c index a3535d1..96fba47 100644 --- a/src/config.c +++ b/src/config.c @@ -56,6 +56,7 @@ parse_priorities(struct config *cfg) list_append_struct(cfg->priorities, p); } + g_strfreev(groups); return 0; @@ -68,6 +69,8 @@ error: g_printerr("Failed to read property in prioritiy group '%s': %s\n", groups[i], error->message); + g_strfreev(groups); + return -1; } @@ -144,6 +147,7 @@ read_input_mappings(struct config *cfg) g_hash_table_insert(cfg->keymap, GINT_TO_POINTER(key), &command_cbs[i]); } + g_strfreev(list); } return 0; diff --git a/src/interface.c b/src/interface.c index a744cfd..9cc31f8 100644 --- a/src/interface.c +++ b/src/interface.c @@ -198,10 +198,17 @@ interface_clear(struct context *ctx) { g_source_remove(ctx->resize_source_id); g_source_remove(ctx->input_source_id); +#ifdef HAVE_SIGNALFD close(ctx->signal_fd); +#endif clear(); refresh(); + delwin(ctx->menu_win); + delwin(ctx->msg_win); endwin(); + delscreen(NULL); + if (ctx->status) + g_free(ctx->status); } void @@ -278,7 +285,8 @@ interface_init(struct context *ctx) exit(EXIT_FAILURE); ctx->signal_fd = signalfd(-1, &mask, 0); channel = g_io_channel_unix_new(ctx->signal_fd); - g_io_add_watch(channel, G_IO_IN, resize_gio, ctx); + ctx->resize_source_id = + g_io_add_watch(channel, G_IO_IN, resize_gio, ctx); g_io_channel_unref(channel); } #else diff --git a/src/pa-sink-ctl.c b/src/pa-sink-ctl.c index b4e3ef4..c3ea04e 100644 --- a/src/pa-sink-ctl.c +++ b/src/pa-sink-ctl.c @@ -174,6 +174,24 @@ sink_info_cb(pa_context *c, const pa_sink_info *i, } static void +sink_free(gpointer data) +{ + struct sink_info *sink = data; + + g_free(sink->name); + g_free(sink); +} + +static void +sink_input_free(gpointer data) +{ + struct sink_input_info *input = data; + + g_free(input->name); + g_free(input); +} + +static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, guint32 idx, gpointer userdata) { @@ -204,13 +222,13 @@ subscribe_cb(pa_context *c, pa_subscription_event_type_t t, case PA_SUBSCRIPTION_EVENT_SINK: object = find_sink_by_idx(ctx, idx); ctx->sink_list = g_list_remove(ctx->sink_list, object); - g_free(object); + sink_free(object); break; case PA_SUBSCRIPTION_EVENT_SINK_INPUT: object = find_sink_input_by_idx(ctx, idx); ctx->input_list = g_list_remove(ctx->input_list, object); - g_free(object); + sink_input_free(object); break; default: return; @@ -339,14 +357,16 @@ main(int argc, char** argv) g_main_loop_run(ctx->loop); interface_clear(ctx); - g_list_free_full(ctx->sink_list, g_free); - g_list_free_full(ctx->input_list, g_free); + g_list_free_full(ctx->sink_list, sink_free); + g_list_free_full(ctx->input_list, sink_input_free); pa_glib_mainloop_free(m); + pa_context_unref(ctx->context); g_main_loop_unref(ctx->loop); config_uninit(&ctx->config); + g_free(ctx); + return 0; } - |