lxdm-0.4.1-git-fix-null-pointer-deref.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From 19f82a206b2cec964cea0475395d63dedf183788 Mon Sep 17 00:00:00 2001
  2. From: Andrea Florio <andrea@opensuse.org>
  3. Date: Fri, 29 Jul 2011 23:59:32 +0200
  4. Subject: [PATCH] fix null pointer dereference
  5. ---
  6. src/config.c | 25 ++++++++++---------------
  7. 1 files changed, 10 insertions(+), 15 deletions(-)
  8. diff --git a/src/config.c b/src/config.c
  9. index 3f92f7b..4603ab4 100644
  10. --- a/src/config.c
  11. +++ b/src/config.c
  12. @@ -125,24 +125,19 @@ static gboolean image_file_valid(const char *filename)
  13. static void update_face_image(GtkWidget *w)
  14. {
  15. GdkPixbuf *pixbuf;
  16. - char *path;
  17. - path=g_build_filename(user->pw_dir,".face",NULL);
  18. - if(access(path,R_OK))
  19. - {
  20. - g_free(path);
  21. - if(ui_nobody)
  22. - pixbuf=gdk_pixbuf_new_from_file_at_scale(ui_nobody,48,48,FALSE,NULL);
  23. - if(!pixbuf)
  24. - pixbuf=gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
  25. + char *path=g_build_filename(user->pw_dir,".face",NULL);
  26. + pixbuf=gdk_pixbuf_new_from_file_at_scale(path,48,48,FALSE,NULL);
  27. + g_free(path);
  28. + if(!pixbuf && ui_nobody)
  29. + pixbuf=gdk_pixbuf_new_from_file_at_scale(ui_nobody,48,48,FALSE,NULL);
  30. + if(!pixbuf)
  31. + pixbuf=gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
  32. "avatar-default", 48,GTK_ICON_LOOKUP_FORCE_SIZE,NULL);
  33. - }
  34. - else
  35. + if(pixbuf)
  36. {
  37. - pixbuf=gdk_pixbuf_new_from_file_at_scale(path,48,48,FALSE,NULL);
  38. - g_free(path);
  39. + gtk_image_set_from_pixbuf(GTK_IMAGE(w),pixbuf);
  40. + g_object_unref(pixbuf);
  41. }
  42. - gtk_image_set_from_pixbuf(GTK_IMAGE(w),pixbuf);
  43. - g_object_unref(pixbuf);
  44. }
  45. static void set_face_file(const char *filename)
  46. --
  47. 1.7.0.1