Mercurial > pidgin
changeset 13413:79682d6f032e
[gaim-migrate @ 15788]
1. We need to check the various "char **" pointers passed to gaim_gtk_notify_emails() to make sure they're not NULL. Sadrul says the PRPLs currently don't send NULLs in. Since nothing guarantees that for other prpls, I think checking is good.
2. Add escaping of the To: field.
3. Fix a memory leak.
#1:
Resolves CID 13
Resolves CID 14
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 07 Mar 2006 01:36:43 +0000 |
parents | d93194613696 |
children | d624a097dc98 |
files | src/gtknotify.c |
diffstat | 1 files changed, 23 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtknotify.c Tue Mar 07 01:19:39 2006 +0000 +++ b/src/gtknotify.c Tue Mar 07 01:36:43 2006 +0000 @@ -409,41 +409,55 @@ dialog = mail_dialog->dialog; while (count--) { - char *from_text = NULL, *subject_text = NULL; + char *to_text = NULL; + char *from_text = NULL; + char *subject_text = NULL; GdkPixbuf *pixbuf; + if (tos != NULL) + to_text = g_markup_escape_text(*tos, -1); if (froms != NULL) from_text = g_markup_escape_text(*froms, -1); - if (subjects != NULL) subject_text = g_markup_escape_text(*subjects, -1); data = g_new0(GaimNotifyMailData, 1); - data->url = g_strdup(*urls); + if (urls != NULL) + data->url = g_strdup(*urls); pixbuf = gaim_gtk_create_prpl_icon(account, 0.5); gtk_tree_store_append(mail_dialog->treemodel, &iter, NULL); gtk_tree_store_set(mail_dialog->treemodel, &iter, GAIM_MAIL_ICON, pixbuf, - GAIM_MAIL_TO, *tos, + GAIM_MAIL_TO, to_text, GAIM_MAIL_FROM, from_text, GAIM_MAIL_SUBJECT, subject_text, GAIM_MAIL_DATA, data, -1); if (pixbuf != NULL) g_object_unref(pixbuf); + g_free(to_text); + g_free(from_text); + g_free(subject_text); data->iter = iter; - urls++; - froms++; - subjects++; - tos++; + + if (urls != NULL) + urls++; + if (froms != NULL) + froms++; + if (subjects != NULL) + subjects++; + if (tos != NULL) + tos++; } } else { data = g_new0(GaimNotifyMailData, 1); - data->url = g_strdup(*urls); + + if (urls != NULL) + data->url = g_strdup(*urls); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(email_nondetailed_cb), data);