Mercurial > pidgin
comparison 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 |
comparison
equal
deleted
inserted
replaced
13101:094d4b49e1c9 | 13102:5828d42e8684 |
---|---|
64 | 64 |
65 static char custom_home_dir[MAXPATHLEN]; | 65 static char custom_home_dir[MAXPATHLEN]; |
66 static char home_dir[MAXPATHLEN]; | 66 static char home_dir[MAXPATHLEN]; |
67 | 67 |
68 GaimMenuAction * | 68 GaimMenuAction * |
69 gaim_menu_action_new(char *label, GaimCallback callback, gpointer data, | 69 gaim_menu_action_new(const char *label, GaimCallback callback, gpointer data, |
70 GList *children) | 70 GList *children) |
71 { | 71 { |
72 GaimMenuAction *act = g_new0(GaimMenuAction, 1); | 72 GaimMenuAction *act = g_new0(GaimMenuAction, 1); |
73 act->label = label; | 73 act->label = g_strdup(label); |
74 act->callback = callback; | 74 act->callback = callback; |
75 act->data = data; | 75 act->data = data; |
76 act->children = children; | 76 act->children = children; |
77 return act; | 77 return act; |
78 } | |
79 | |
80 void | |
81 gaim_menu_action_free(GaimMenuAction *act) | |
82 { | |
83 g_return_if_fail(act != NULL); | |
84 | |
85 g_free(act->label); | |
86 g_free(act); | |
78 } | 87 } |
79 | 88 |
80 /************************************************************************** | 89 /************************************************************************** |
81 * Base16 Functions | 90 * Base16 Functions |
82 **************************************************************************/ | 91 **************************************************************************/ |