Code

options: added options_deinit()
authorMax Kellermann <max@duempel.org>
Fri, 14 Aug 2009 21:44:06 +0000 (23:44 +0200)
committerMax Kellermann <max@duempel.org>
Fri, 14 Aug 2009 21:44:06 +0000 (23:44 +0200)
Clean up before exiting, make valgrind happy.

src/main.c
src/options.c
src/options.h

index c80b7ea1fe3f0a0fc26eb082589645c0a5ae3587..fc733664c93a39a91ac282e982b4af35180b62b9 100644 (file)
@@ -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;
 }
index c4540d38f25f17b42859b94c1e1bd2279ed97738..99dddedd236f163348f9452220a2bdda181ae704 100644 (file)
@@ -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);
+}
index 5927d4c443b8d9e84727709ccc20f33e1275bf62..1cc2eb7f4f683abf9d9993fd0e6f40bfd4e385cf 100644 (file)
@@ -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