pidgin/pidgin

finch: Fix possible leaks.

2019-10-02, Elliott Sales de Andrade
05d2cd3d93df
Parents d3887f548a28
Children 4787df20fdc4
finch: Fix possible leaks.
--- a/finch/gntaccount.c Wed Oct 02 02:30:48 2019 -0400
+++ b/finch/gntaccount.c Wed Oct 02 02:32:11 2019 -0400
@@ -172,6 +172,7 @@
"server."),
purple_request_cpar_from_account(
account));
+ g_string_free(username, TRUE);
return;
}
--- a/finch/gntnotify.c Wed Oct 02 02:30:48 2019 -0400
+++ b/finch/gntnotify.c Wed Oct 02 02:32:11 2019 -0400
@@ -211,24 +211,24 @@
const char **urls)
{
PurpleAccount *account = purple_connection_get_account(gc);
- GString *message = g_string_new(NULL);
- void *ret;
+ void *ret = NULL;
static int key = 0;
if (count == 0)
return NULL;
- if (!detailed)
- {
- g_string_append_printf(message,
- ngettext("%s (%s) has %d new message.",
- "%s (%s) has %d new messages.",
- (int)count),
- tos ? *tos : purple_account_get_username(account),
- purple_account_get_protocol_name(account), (int)count);
- }
- else
- {
+ if (!detailed) {
+ gchar *message;
+ message = g_strdup_printf(
+ ngettext("%s (%s) has %d new message.",
+ "%s (%s) has %d new messages.", (int)count),
+ tos ? *tos : purple_account_get_username(account),
+ purple_account_get_protocol_name(account), (int)count);
+ ret = finch_notify_common(PURPLE_NOTIFY_EMAIL, PURPLE_NOTIFY_MSG_INFO,
+ _("New Mail"), _("You have mail!"), message,
+ NULL);
+ g_free(message);
+ } else {
char *to;
gboolean newwin = (emaildialog.window == NULL);
@@ -247,12 +247,9 @@
gnt_widget_show(emaildialog.window);
else
gnt_window_present(emaildialog.window);
- return NULL;
+ ret = NULL;
}
- ret = finch_notify_common(PURPLE_NOTIFY_EMAIL, PURPLE_NOTIFY_MSG_INFO,
- _("New Mail"), _("You have mail!"), message->str, NULL);
- g_string_free(message, TRUE);
return ret;
}