Fix CID 1491296, 1491368, 1491288 and 1491322: dereference before null check.
authorwwp <subscript@free.fr>
Wed, 29 Sep 2021 10:59:53 +0000 (12:59 +0200)
committerwwp <subscript@free.fr>
Wed, 29 Sep 2021 10:59:53 +0000 (12:59 +0200)
src/plugins/notification/notification_popup.c
src/plugins/notification/notification_trayicon.c

index baa0826428bab3a273375ce299096d6ae84889e3..d8abfbd8ffb63061f26c933b5ed9ce171a5a6056 100644 (file)
@@ -286,9 +286,9 @@ static gboolean notification_libnotify_create(MsgInfo *msginfo,
   NotificationPopup *ppopup;
   gchar *summary = NULL;
   gchar *text = NULL;
   NotificationPopup *ppopup;
   gchar *summary = NULL;
   gchar *text = NULL;
-  gchar *utf8_str = NULL;
-  gchar *subj = NULL;
-  gchar *from = NULL;
+  gchar *utf8_str;
+  gchar *subj;
+  gchar *from;
   gchar *foldname = NULL;
   GList *caps = NULL;
   gboolean support_actions = FALSE;
   gchar *foldname = NULL;
   GList *caps = NULL;
   gboolean support_actions = FALSE;
@@ -322,10 +322,10 @@ static gboolean notification_libnotify_create(MsgInfo *msginfo,
 
     /* Make sure text is valid UTF8 */
     utf8_str = notification_validate_utf8_str(text);
 
     /* Make sure text is valid UTF8 */
     utf8_str = notification_validate_utf8_str(text);
-    g_free(text);
 
 
-    if(from) g_free(from);
-    if(subj) g_free(subj);
+    g_free(text);
+    g_free(from);
+    g_free(subj);
     if(foldname) g_free(foldname);
     break;
   case F_TYPE_NEWS:
     if(foldname) g_free(foldname);
     break;
   case F_TYPE_NEWS:
index f67d81d4713c109b11921bfd3799ebe60b72d50e..c35781f77e81e239c9eadefc32d6b72062cdfa5d 100644 (file)
@@ -897,10 +897,10 @@ static gchar* notification_trayicon_popup_assemble_body(MsgInfo *msginfo)
 
       /* Make sure text is valid UTF8 */
       utf8_str = notification_validate_utf8_str(text);
 
       /* Make sure text is valid UTF8 */
       utf8_str = notification_validate_utf8_str(text);
-      g_free(text);
 
 
-      if(from) g_free(from);
-      if(subj) g_free(subj);
+      g_free(text);
+      g_free(from);
+      g_free(subj);
          if(foldname) g_free(foldname);
     }
     else if(popup.num_calendar) {
          if(foldname) g_free(foldname);
     }
     else if(popup.num_calendar) {