[git] GpgOL - branch, master, updated. gpgol-2.2.0-115-g43cd178

by Andre Heinecke cvs at cvs.gnupg.org
Mon Jul 23 16:11:06 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, master has been updated
       via  43cd17881983b02d90062bca8050f07c97fe325f (commit)
       via  9d83c52581904721c588b50fdd2e15bb7c959d0c (commit)
       via  39c6972b0cd4cb246a9b00c7cdb065fa9f0f3e81 (commit)
       via  ba00082d4606a7b27e07de41924c05f655cbb727 (commit)
       via  8865d390bed5cb9605cf3d4a62688a9b1c627b23 (commit)
       via  d740a8afd0c1b65216701f2cc4ac486e867d5b9d (commit)
       via  2c19657c31369e9791f6aae035331c3e8cf61cd8 (commit)
       via  0d2d92689189178a14bd4c86bba6960667e1d6e6 (commit)
       via  eb9236394ef217d908df44d9839b18c293ac0564 (commit)
      from  26d222dfd48c4726d2699a9ec40df5dd6ecafe1f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 43cd17881983b02d90062bca8050f07c97fe325f
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Jul 23 16:09:51 2018 +0200

    Fix important memleak in get_mail_from_control
    
    * src/ribbon-callbacks.cpp (get_mail_from_control): Fix memleak.
    
    --
    This function is called 4 times for each invalidate UI so this
    leak is important even if it just leaks a few bytes.

diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 6c50a40..d2310e0 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -357,8 +357,15 @@ get_mail_from_control (LPDISPATCH ctrl, bool *none_selected)
                  hr);
       return NULL;
     }
+  char *name = get_object_name (context);
 
-  const auto ctx_name = std::string (get_object_name (context));
+  std::string ctx_name;
+
+  if (name)
+    {
+      ctx_name = name;
+      xfree (name);
+    }
 
   if (ctx_name.empty())
     {

commit 9d83c52581904721c588b50fdd2e15bb7c959d0c
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Jul 23 16:08:52 2018 +0200

    Improve wchar and utf8 conversion memdbg
    
    * src/w32-gettext.h (wchar_to_utf8, utf8_to_wchar): replace
    by logging macros.

diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 03d4d98..6c50a40 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -288,8 +288,7 @@ HRESULT get_crypt_pressed (LPDISPATCH ctrl, int flags, VARIANT *result,
   LPMESSAGE message = NULL;
 
   result->vt = VT_BOOL | VT_BYREF;
-  result->pboolVal = (VARIANT_BOOL*) xmalloc (sizeof (VARIANT_BOOL));
-  *(result->pboolVal) = VARIANT_FALSE;
+  result->pboolVal = &var_false;
 
   /* First the usual defensive check about our parameters */
   if (!ctrl || !result)
diff --git a/src/w32-gettext.h b/src/w32-gettext.h
index 7374ae9..7232147 100644
--- a/src/w32-gettext.h
+++ b/src/w32-gettext.h
@@ -64,12 +64,19 @@ static inline const char *gettext_localename (void) { return ""; }
 
 #endif	/* !ENABLE_NLS */
 
+
+/* Conversion function. */
+char *_wchar_to_utf8 (const wchar_t *string);
+wchar_t *_utf8_to_wchar (const char *string);
+char *utf8_to_native (const char *string);
+char *native_to_utf8 (const char *string);
+
 #define utf8_to_wchar(VAR1) ({wchar_t *retval; \
   retval = _utf8_to_wchar (VAR1); \
   if ((opt.enable_debug & DBG_OOM_EXTRA)) \
   { \
-    log_debug ("%s:%s:%i wchar_t alloc %p", \
-               SRCNAME, __func__, __LINE__, retval); \
+    log_debug ("%s:%s:%i wchar_t alloc %p:%S", \
+               SRCNAME, __func__, __LINE__, retval, retval); \
   } \
 retval;})
 
@@ -77,18 +84,11 @@ retval;})
   retval = _wchar_to_utf8 (VAR1); \
   if ((opt.enable_debug & DBG_OOM_EXTRA)) \
   { \
-    log_debug ("%s:%s:%i char utf8 alloc %p", \
-               SRCNAME, __func__, __LINE__, retval); \
+    log_debug ("%s:%s:%i char utf8 alloc %p:%s", \
+               SRCNAME, __func__, __LINE__, retval, retval); \
   } \
 retval;})
 
-
-/* Conversion function. */
-char *_wchar_to_utf8 (const wchar_t *string);
-wchar_t *_utf8_to_wchar (const char *string);
-char *utf8_to_native (const char *string);
-char *native_to_utf8 (const char *string);
-
 #ifdef __cplusplus
 }
 #include <string>

commit 39c6972b0cd4cb246a9b00c7cdb065fa9f0f3e81
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Jul 23 16:07:57 2018 +0200

    Remove dead code
    
    * src/mail.cpp, src/mail.h (getHTMLBody_o): Removed.

diff --git a/src/mail.cpp b/src/mail.cpp
index 1faf8dd..afad308 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -1811,12 +1811,6 @@ Mail::getBody_o () const
   return get_string_o (m_mailitem, "Body");
 }
 
-std::string
-Mail::getHTMLBody_o () const
-{
-  return get_string_o (m_mailitem, "HTMLBody");
-}
-
 std::vector<std::string>
 Mail::getRecipients_o () const
 {
diff --git a/src/mail.h b/src/mail.h
index ef04c9f..cc4a78b 100644
--- a/src/mail.h
+++ b/src/mail.h
@@ -391,9 +391,6 @@ public:
   /** Get the body of the mail */
   std::string getBody_o () const;
 
-  /** Get the html of the mail */
-  std::string getHTMLBody_o () const;
-
   /** Get the recipients. */
   std::vector<std::string> getRecipients_o () const;
 

commit ba00082d4606a7b27e07de41924c05f655cbb727
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Jul 23 16:07:09 2018 +0200

    Minor initialzation
    
    * src/mail.cpp (Mail::decryptVerify_o): Initialize placeholder.

diff --git a/src/mail.cpp b/src/mail.cpp
index a03a7d9..1faf8dd 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -997,7 +997,7 @@ Mail::decryptVerify_o ()
 
 
   /* Insert placeholder */
-  char *placeholder_buf;
+  char *placeholder_buf = nullptr;
   if (m_type == MSGTYPE_GPGOL_WKS_CONFIRMATION)
     {
       gpgrt_asprintf (&placeholder_buf, opt.prefer_html ? decrypt_template_html :

commit 8865d390bed5cb9605cf3d4a62688a9b1c627b23
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Jul 23 16:06:35 2018 +0200

    Fix super minor memleak
    
    * src/gpgoladdin.cpp (GpgolAddin::OnConnection): Release
    version.

diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp
index cf58167..abf8e71 100644
--- a/src/gpgoladdin.cpp
+++ b/src/gpgoladdin.cpp
@@ -344,6 +344,7 @@ GpgolAddin::OnConnection (LPDISPATCH Application, ext_ConnectMode ConnectMode,
       return S_OK;
     }
 
+  xfree (version);
   setupDoNotDisable ();
 
   if (ConnectMode != ext_cm_Startup)

commit d740a8afd0c1b65216701f2cc4ac486e867d5b9d
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Jul 23 15:34:35 2018 +0200

    Fix memleak in put_pa_string
    
    * src/oomhelp.cpp (put_pa_string): Fix memleak.
    
    --
    Its a definitve but not a major or critical memleak. In a usual
    setup this would leak ~32 Bytes per mail.

diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index 297fe0b..947ffce 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -979,6 +979,7 @@ put_pa_string (LPDISPATCH pDisp, const char *dasl_id, const char *value)
 {
   wchar_t *w_value = utf8_to_wchar (value);
   BSTR b_value = SysAllocString(w_value);
+  xfree (w_value);
   VARIANT var;
   VariantInit (&var);
   var.vt = VT_BSTR;

commit 2c19657c31369e9791f6aae035331c3e8cf61cd8
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Jul 23 15:24:22 2018 +0200

    Add caller debugging for wchar / utf8 convs
    
    * src/w32-gettext.cpp, src/w32-gettext.h (utf8_to_wchar),
    (wchar_to_utf8): Improve tracing for memory debug.
    
    --
    We have some leaks here.

diff --git a/src/w32-gettext.cpp b/src/w32-gettext.cpp
index 9d9a515..edad1fd 100644
--- a/src/w32-gettext.cpp
+++ b/src/w32-gettext.cpp
@@ -1466,7 +1466,7 @@ native_to_wchar (const char *string)
    The result of calling this function with STRING set to NULL is not
    defined. */
 wchar_t *
-utf8_to_wchar (const char *string)
+_utf8_to_wchar (const char *string)
 {
   int n;
   wchar_t *result;
@@ -1495,7 +1495,7 @@ utf8_to_wchar (const char *string)
    The result of calling this function with STRING set to NULL is not
    defined. */
 char *
-wchar_to_utf8 (const wchar_t *string)
+_wchar_to_utf8 (const wchar_t *string)
 {
   int n;
   char *result;
diff --git a/src/w32-gettext.h b/src/w32-gettext.h
index 7010586..7374ae9 100644
--- a/src/w32-gettext.h
+++ b/src/w32-gettext.h
@@ -64,10 +64,28 @@ static inline const char *gettext_localename (void) { return ""; }
 
 #endif	/* !ENABLE_NLS */
 
-/* Conversion function. */
-char *wchar_to_utf8 (const wchar_t *string);
-wchar_t *utf8_to_wchar (const char *string);
+#define utf8_to_wchar(VAR1) ({wchar_t *retval; \
+  retval = _utf8_to_wchar (VAR1); \
+  if ((opt.enable_debug & DBG_OOM_EXTRA)) \
+  { \
+    log_debug ("%s:%s:%i wchar_t alloc %p", \
+               SRCNAME, __func__, __LINE__, retval); \
+  } \
+retval;})
+
+#define wchar_to_utf8(VAR1) ({char *retval; \
+  retval = _wchar_to_utf8 (VAR1); \
+  if ((opt.enable_debug & DBG_OOM_EXTRA)) \
+  { \
+    log_debug ("%s:%s:%i char utf8 alloc %p", \
+               SRCNAME, __func__, __LINE__, retval); \
+  } \
+retval;})
+
 
+/* Conversion function. */
+char *_wchar_to_utf8 (const wchar_t *string);
+wchar_t *_utf8_to_wchar (const char *string);
 char *utf8_to_native (const char *string);
 char *native_to_utf8 (const char *string);
 

commit 0d2d92689189178a14bd4c86bba6960667e1d6e6
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Jul 23 15:22:25 2018 +0200

    Use static references for VARAINT_BOOL | BYREF
    
    * src/ribbon-callbacks.cpp (get_crypt_pressed),
    (get_is_details_enabled, get_is_crypto_mail): Reference a static.
    
    --
    I really don't understand it but malloc'ing also seems wrong
    as we leak heap mem here.
    These references to static variables appear to work.

diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp
index 42a020e..03d4d98 100644
--- a/src/ribbon-callbacks.cpp
+++ b/src/ribbon-callbacks.cpp
@@ -48,6 +48,12 @@
 
 using namespace GpgME;
 
+/* This is so super stupid. I bet even Microsft developers laugh
+   about the definition of VARIANT_BOOL. And then for COM we
+   have to pass pointers to this stuff. */
+static VARIANT_BOOL var_true = VARIANT_TRUE;
+static VARIANT_BOOL var_false = VARIANT_FALSE;
+
 /* Gets the context of a ribbon control. And prints some
    useful debug output */
 HRESULT getContext (LPDISPATCH ctrl, LPDISPATCH *context)
@@ -322,7 +328,7 @@ HRESULT get_crypt_pressed (LPDISPATCH ctrl, int flags, VARIANT *result,
 
   value = (get_gpgol_draft_info_flags (message) & flags) == flags;
 
-  *(result->pboolVal) = value ? VARIANT_TRUE : VARIANT_FALSE;
+  *(result->pboolVal) = value ? var_true: var_false;
 
 done:
   gpgol_release (context);
@@ -534,8 +540,7 @@ HRESULT get_is_details_enabled (LPDISPATCH ctrl, VARIANT *result)
     }
 
   result->vt = VT_BOOL | VT_BYREF;
-  result->pboolVal = (VARIANT_BOOL*) xmalloc (sizeof (VARIANT_BOOL));
-  *(result->pboolVal) = none_selected ? VARIANT_FALSE : VARIANT_TRUE;
+  result->pboolVal = none_selected ? &var_false : &var_true;
 
   TRACEPOINT;
   return S_OK;
@@ -730,9 +735,8 @@ HRESULT get_is_crypto_mail (LPDISPATCH ctrl, VARIANT *result)
   MY_MAIL_GETTER
 
   result->vt = VT_BOOL | VT_BYREF;
-  result->pboolVal = (VARIANT_BOOL*) xmalloc (sizeof (VARIANT_BOOL));
-  *(result->pboolVal) = (mail && (mail->isSigned () || mail->isEncrypted ())) ?
-                          VARIANT_TRUE : VARIANT_FALSE;
+  result->pboolVal = mail && (mail->isSigned () || mail->isEncrypted ()) ?
+                          &var_true : &var_false;
 
   TRACEPOINT;
   return S_OK;

commit eb9236394ef217d908df44d9839b18c293ac0564
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Mon Jul 23 15:21:14 2018 +0200

    Fix unlikely error memleak
    
    * src/mapihel.cpp (mapi_get_message_content_type): Fix error
    handling meleak.

diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp
index abf94a6..ecd45f8 100644
--- a/src/mapihelp.cpp
+++ b/src/mapihelp.cpp
@@ -3109,6 +3109,7 @@ mapi_get_message_content_type (LPMESSAGE message,
 
       log_error ("%s:%s: failed to get headers",
                  SRCNAME, __func__);
+      rfc822parse_close (msg);
       return NULL;
     }
 

-----------------------------------------------------------------------

Summary of changes:
 src/gpgoladdin.cpp       |  1 +
 src/mail.cpp             |  8 +-------
 src/mail.h               |  3 ---
 src/mapihelp.cpp         |  1 +
 src/oomhelp.cpp          |  1 +
 src/ribbon-callbacks.cpp | 28 +++++++++++++++++++---------
 src/w32-gettext.cpp      |  4 ++--
 src/w32-gettext.h        | 24 +++++++++++++++++++++---
 8 files changed, 46 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list