changeset 7093:3650612c7daa

[gaim-migrate @ 7658] Memleak bad! Space-indentation bad! Fire bad! Call Lars! Call Regis! committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 01 Oct 2003 02:06:12 +0000
parents f89146deac3d
children 2343c3aa1dec
files src/protocols/oscar/oscar.c
diffstat 1 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Wed Oct 01 01:47:52 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Oct 01 02:06:12 2003 +0000
@@ -1818,20 +1818,22 @@
 
 	/* Server stored icon stuff */
 	if (info->iconcsumlen) {
-		char *b16, *saved_b16;
-		GaimBuddy *b;
-                FILE *file;
+		char *filename = NULL, *b16 = NULL, *saved_b16 = NULL;
+		GaimBuddy *b = NULL;
 
 		b16 = tobase16(info->iconcsum, info->iconcsumlen);
 		b = gaim_find_buddy(gc->account, info->sn);
-                /* If for some reason the checksum is valid, but cached file is not..
-                   we want to know. */
-                if((file = fopen(gaim_buddy_get_setting(b, "buddy_icon"), "rb"))) {
-                        fclose(file);
-                        saved_b16 = gaim_buddy_get_setting(b, "icon_checksum");
-                }
-                else
-                        saved_b16 = NULL;
+		/*
+		 * If for some reason the checksum is valid, but cached file is not..
+		 * we want to know.
+		 */
+		filename = gaim_buddy_get_setting(b, "buddy_icon");
+		if (filename != NULL) {
+			if (g_file_test(filename, G_FILE_TEST_EXISTS))
+				saved_b16 = gaim_buddy_get_setting(b, "icon_checksum");
+			g_free(filename);
+		} else
+			saved_b16 = NULL;
 
 		if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) {
 			GSList *cur = od->requesticon;