[gnome-commander/gcmd-1-10: 55/57] Initialization list, fix possible null pointer dereference issue



commit 8957e7a5c2a231d6c5ea867b6d332886503c809c
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Thu Apr 11 18:54:52 2019 +0200

    Initialization list, fix possible null pointer dereference issue

 src/gnome-cmd-main-win.cc | 6 +++---
 src/gnome-cmd-owner.cc    | 4 ----
 src/gnome-cmd-owner.h     | 6 +++---
 3 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index 55d3315d..e6d891f3 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -1,4 +1,4 @@
-/** 
+/**
  * @file gnome-cmd-main-win.cc
  * @copyright (C) 2001-2006 Marcus Bjurman\n
  * @copyright (C) 2007-2012 Piotr Eljasiak\n
@@ -743,10 +743,10 @@ static void destroy (GtkObject *object)
         main_win->priv->key_snooper_id = 0;
     }
 
-    if (main_win->advrename_dlg)
+    if (main_win && main_win->advrename_dlg)
         gtk_widget_destroy (*main_win->advrename_dlg);
 
-    if (main_win->file_search_dlg)
+    if (main_win && main_win->file_search_dlg)
         gtk_widget_destroy (*main_win->file_search_dlg);
 
     gtk_main_quit ();
diff --git a/src/gnome-cmd-owner.cc b/src/gnome-cmd-owner.cc
index 9a76f1c5..0435f2b7 100644
--- a/src/gnome-cmd-owner.cc
+++ b/src/gnome-cmd-owner.cc
@@ -43,10 +43,6 @@ static gint compare_names (const gchar *name1, const gchar *name2)
 
 GnomeCmdOwner::GnomeCmdOwner()
 {
-    thread = NULL;
-    stop_thread = FALSE;
-    group_names = NULL;
-
     if (!buff)
     {
         long int pw_size = sysconf(_SC_GETPW_R_SIZE_MAX);
diff --git a/src/gnome-cmd-owner.h b/src/gnome-cmd-owner.h
index 42b6e232..1c946319 100644
--- a/src/gnome-cmd-owner.h
+++ b/src/gnome-cmd-owner.h
@@ -26,15 +26,15 @@
 
 class GnomeCmdOwner
 {
-    GThread *thread;
-    gboolean stop_thread;
+    GThread *thread {nullptr};
+    gboolean stop_thread {FALSE};
     char *buff;
     size_t buffsize;
 
     uid_t user_id;
     gid_t group_id;
 
-    GList *group_names;
+    GList *group_names {nullptr};
 
   public:
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]