Mercurial > pidgin
diff src/util.c @ 13102:5828d42e8684
[gaim-migrate @ 15464]
g_strdup() and free the label for a menu action. This way, if a plugin builds the label dynamically, we won't leak.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Thu, 02 Feb 2006 19:35:32 +0000 |
parents | f1bf8989bbf2 |
children | e1e5462b7d81 |
line wrap: on
line diff
--- a/src/util.c Thu Feb 02 19:17:49 2006 +0000 +++ b/src/util.c Thu Feb 02 19:35:32 2006 +0000 @@ -66,17 +66,26 @@ static char home_dir[MAXPATHLEN]; GaimMenuAction * -gaim_menu_action_new(char *label, GaimCallback callback, gpointer data, +gaim_menu_action_new(const char *label, GaimCallback callback, gpointer data, GList *children) { GaimMenuAction *act = g_new0(GaimMenuAction, 1); - act->label = label; + act->label = g_strdup(label); act->callback = callback; act->data = data; act->children = children; return act; } +void +gaim_menu_action_free(GaimMenuAction *act) +{ + g_return_if_fail(act != NULL); + + g_free(act->label); + g_free(act); +} + /************************************************************************** * Base16 Functions **************************************************************************/