You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/lxde-base/lxdm/files/lxdm-0.4.1-git-fix-null-poi...

52 lines
1.5 KiB

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