diff libpurple/util.c @ 21248:5915ad785ee7

Add and call a purple_util_uninit() to free user_dir and customer_home_dir at shutdown. Fixes #3132
author Richard Laager <rlaager@wiktel.com>
date Mon, 15 Oct 2007 00:41:22 +0000
parents aa420b502a6b
children b3c6d817d68d
line wrap: on
line diff
--- a/libpurple/util.c	Mon Oct 15 00:40:33 2007 +0000
+++ b/libpurple/util.c	Mon Oct 15 00:41:22 2007 +0000
@@ -70,6 +70,7 @@
 static char *custom_user_dir = NULL;
 static char *user_dir = NULL;
 
+
 PurpleMenuAction *
 purple_menu_action_new(const char *label, PurpleCallback callback, gpointer data,
                      GList *children)
@@ -91,6 +92,25 @@
 	g_free(act);
 }
 
+void
+purple_util_init(void)
+{
+	/* This does nothing right now.  It exists for symmetry with 
+	 * purple_util_uninit() and forwards compatibility. */
+}
+
+void
+purple_util_uninit(void)
+{
+	/* Free these so we don't have leaks at shutdown. */
+
+	g_free(custom_user_dir);
+	custom_user_dir = NULL;
+
+	g_free(user_dir);
+	user_dir = NULL;
+}
+
 /**************************************************************************
  * Base16 Functions
  **************************************************************************/