summaryrefslogtreecommitdiff
path: root/lxde-base/lxdm/files/lxdm-0.4.1-git-fix-null-pointer-deref.patch
blob: 7abdbd4705231a1bcea177e3586dc1069c39b509 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 19f82a206b2cec964cea0475395d63dedf183788 Mon Sep 17 00:00:00 2001
From: Andrea Florio <andrea@opensuse.org>
Date: Fri, 29 Jul 2011 23:59:32 +0200
Subject: [PATCH] fix null pointer dereference

---
 src/config.c |   25 ++++++++++---------------
 1 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/src/config.c b/src/config.c
index 3f92f7b..4603ab4 100644
--- a/src/config.c
+++ b/src/config.c
@@ -125,24 +125,19 @@ static gboolean image_file_valid(const char *filename)
 static void update_face_image(GtkWidget *w)
 {
 	GdkPixbuf *pixbuf;
-	char *path;
-	path=g_build_filename(user->pw_dir,".face",NULL);
-	if(access(path,R_OK))
-	{
-		g_free(path);
-		if(ui_nobody)
-			pixbuf=gdk_pixbuf_new_from_file_at_scale(ui_nobody,48,48,FALSE,NULL);
-		if(!pixbuf)
-			pixbuf=gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
+	char *path=g_build_filename(user->pw_dir,".face",NULL);
+	pixbuf=gdk_pixbuf_new_from_file_at_scale(path,48,48,FALSE,NULL);
+	g_free(path);
+	if(!pixbuf && ui_nobody)
+		pixbuf=gdk_pixbuf_new_from_file_at_scale(ui_nobody,48,48,FALSE,NULL);
+	if(!pixbuf)
+		pixbuf=gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
 						"avatar-default", 48,GTK_ICON_LOOKUP_FORCE_SIZE,NULL);
-	}
-	else
+	if(pixbuf)
 	{
-		pixbuf=gdk_pixbuf_new_from_file_at_scale(path,48,48,FALSE,NULL);
-		g_free(path);
+		gtk_image_set_from_pixbuf(GTK_IMAGE(w),pixbuf);
+		g_object_unref(pixbuf);
 	}
-	gtk_image_set_from_pixbuf(GTK_IMAGE(w),pixbuf);
-	g_object_unref(pixbuf);
 }
 
 static void set_face_file(const char *filename)
-- 
1.7.0.1