From: Max Kellermann Date: Fri, 14 Aug 2009 21:44:06 +0000 (+0200) Subject: options: added options_deinit() X-Git-Tag: release-0.15~37 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=196f06b51433fca070afecb46f9ecf6492bf455a;p=ncmpc.git options: added options_deinit() Clean up before exiting, make valgrind happy. --- diff --git a/src/main.c b/src/main.c index c80b7ea..fc73366 100644 --- a/src/main.c +++ b/src/main.c @@ -141,14 +141,6 @@ exit_and_cleanup(void) mpdclient_disconnect(mpd); mpdclient_free(mpd); } - - g_free(options.host); - g_free(options.password); - g_free(options.list_format); - g_free(options.status_format); -#ifndef NCMPC_MINI - g_free(options.scroll_sep); -#endif } static void @@ -540,6 +532,7 @@ main(int argc, const char *argv[]) #endif ncu_deinit(); + options_deinit(); return 0; } diff --git a/src/options.c b/src/options.c index c4540d3..99ddded 100644 --- a/src/options.c +++ b/src/options.c @@ -398,3 +398,21 @@ options_init(void) options.scroll_sep = g_strdup(DEFAULT_SCROLL_SEP); #endif } + +void +options_deinit(void) +{ + g_free(options.host); + g_free(options.username); + g_free(options.password); + g_free(options.config_file); + g_free(options.key_file); + g_free(options.list_format); + g_free(options.status_format); + g_strfreev(options.screen_list); +#ifndef NCMPC_MINI + g_free(options.xterm_title_format); + g_free(options.scroll_sep); +#endif + g_free(options.timedisplay_type); +} diff --git a/src/options.h b/src/options.h index 5927d4c..1cc2eb7 100644 --- a/src/options.h +++ b/src/options.h @@ -83,6 +83,8 @@ typedef struct { extern options_t options; void options_init(void); +void options_deinit(void); + void options_parse(int argc, const char **argv); #endif