[balsa] mailbox: initialize a view by struct assignment



commit ef84d3ad0934e164998c25ba433d716bc1c70a2c
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Feb 18 13:31:54 2019 -0500

    mailbox: initialize a view by struct assignment
    
    Clang's static analyzer doesn't understand g_memdup(); we can avoid
    some false positives by assigning the structure instead.
    
    * libbalsa/mailbox.c (libbalsa_mailbox_view_new): initialize a
    view by structure assignment instead of g_memdup().

 ChangeLog          | 5 +++++
 libbalsa/mailbox.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 577a20174..b10f53c34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-02-18  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       * libbalsa/mailbox.c (libbalsa_mailbox_view_new): initialize a
+       view by structure assignment instead of g_memdup().
+
 2019-02-18  Peter Bloomfield  <pbloomfield bellsouth net>
 
        * libbalsa/address.c (libbalsa_address_new_from_vcard): do not
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index b95152eee..7c10b3371 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -2312,8 +2312,8 @@ libbalsa_mailbox_view_new(void)
 {
     LibBalsaMailboxView *view;
 
-    view = g_memdup(&libbalsa_mailbox_view_default,
-                   sizeof libbalsa_mailbox_view_default);
+    view = g_new(LibBalsaMailboxView, 1);
+    *view = libbalsa_mailbox_view_default;
 
     return view;
 }


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